I have an problem with this example (in attached).
The example shows a image and a text in Activity2, using the information of the Process Global variables in the Main acitivity:
If I change to another app and return to this example, sometimes, I get this error (the information of variable is lost). See the log and the sequence of images.
The information of process global variable "Main.img1", with the name of image file "android.jpg" is empty and raises the error "File Not Found".
I don't know what is happening.
Thanks in advance for any tip to fix this problem.
The example shows a image and a text in Activity2, using the information of the Process Global variables in the Main acitivity:
B4X:
Dim bmp1 As Bitmap
bmp1.Initialize(File.DirAssets, Main.img1)
ImageView1.Bitmap = bmp1
Label1.Text = Main.text1
B4X:
java.io.FileNotFoundException:
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:409)
at android.content.res.AssetManager.open(AssetManager.java:383)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:202)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:498)
at b4a.example.applostfocus.activity2._activity_create(activity2.java:329)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at b4a.example.applostfocus.activity2.afterFirstLayout(activity2.java:100)
at b4a.example.applostfocus.activity2.access$100(activity2.java:17)
at b4a.example.applostfocus.activity2$WaitForLayout.run(activity2.java:78)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5214)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:814)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
at dalvik.system.NativeStart.main(Native Method)
java.io.FileNotFoundException:
** Activity (activity2) Resume **
The information of process global variable "Main.img1", with the name of image file "android.jpg" is empty and raises the error "File Not Found".
I don't know what is happening.
Thanks in advance for any tip to fix this problem.
Attachments
Last edited: