Initialized error on second call of Activity_Create…

DevBaby

Active Member
Licensed User
Longtime User
In my Activity_Create, I create panels (that I declare and initialize in code). From here, I load a layout (that I created in the designer) to the Panel. There are about 12 of these panel / layout combinations.

The app loads fine until I hit the back button (Kindle) or open the physical keyboard (phone). I then get an initialized error when the Activity_Create sub is called again.


On the Kindle, when I hit the back button and re-launch, I get an initialized error on the Activity_Create section. The error is always an imageview (created and initialized in the designer) when loading a layout onto a panel. This happens about 20% of the time.

On the phone, when I open the physical keyboard, the app closes and automatically calls Activity_Create, I then get an initialized error on the panel (initialized in code during Activity_Create). This happens every time.

The only way I can get around this is to call ExitApplication on Activity_Pause, but this kills the process altogether even if only the home button is pressed or another app is opened.

I asked about the Kindle before, and the image size may be the issue. I am wondering if anyone can help me solve the issues on both devices.
 

BarrySumpter

Active Member
Licensed User
Longtime User
Yes, please be sure to use the
File | Save as Zip
In the B4A ide to make sure all the components are included.

Also be sure to search on these key words
as this is a common error that may have already been answered.
 
Upvote 0

DevBaby

Active Member
Licensed User
Longtime User
Thanks everyone…

Klaus, this does look like my issue in the example you sent. However, many of my images are placed in imageviews that are placed on panels that stay active throughout the lifecycle of the app.

I am using images that I purchased from a photographer, how can I reduce the size of the originals? I am loading about 11 images in total that average about 600kb each.
 
Upvote 0

DevBaby

Active Member
Licensed User
Longtime User
Thanks for your help.

I load the images in the designer. One image, for example is

319x480 pixels
4.4” x 6.7” @72 dpi

I am not sure how the app handles this size when I put it on an imageview that has a width of 100 and a length of 150 (320 x 480 layout at 160 dpi).

The biggest image is the splashscreen that I believe I am deleting from memory (with removeview) after it finishes.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…