Android Question Error when running application (android.view.InflateException error)

Catherine Trudel

Member
Licensed User
Longtime User
Hi,
I'm compiling an old project (done by someone else) and adding new functions to it. When I add new image views to it i get an android.view.InflateException error and the program starts on a panel that it's not supposed to start to. Sometime if i erase the application on the tablet it works correctly (not always). I previously managed to add 2 new panels and some imageviews without any problems, but those new things I want to add don't work correctly.
 

Catherine Trudel

Member
Licensed User
Longtime User
I believe that this loop verifies if a USB UART is present (on the device this is always plugged in and it's just a required verification for some standards we have to adhere to). Then the intro panel loads up. I don't think it's an issue because we use similar code as well as the FTP library in other devices.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should never create such loops. You can add calls to Sleep inside to allow the main thread to process the message queue (make sure to watch the resumable subs tutorial).

As I wrote it might be a memory issue. These messages:
Downsampling image due to lack of memory.

Mean that the process ran out of available memory and now it tries to downsample to images. Start with fixing it.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
I don't understand how to load the images other than selecting it in the views and enabling or disabling them to get whatever I want on the interface, am I missing something? I'm new to B4A and I just went with whatever I saw that was done in this code before.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
For the old FTP library we will probably be stuck with it because this specific code is refered to in software validations reports we submitted to certifying bodies, it's the interface in a medical device and we use it to be able to update the firmware and software through our FTP site. It's very tedious work (and expensive) to change anything they reviewed and approved.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I don't understand how to load the images other than selecting it in the views and enabling or disabling them to get whatever I want on the interface, am I missing something?
No. Make sure not to load too many large images. For example if you are loading multiple images for each button.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
Have I struck up a limit of B4A or Android itself?
How do people build graphic interfaces and pretty them up?
Do you have to stick with default android buttons if you have more than a total 20 buttons in a few different screens in your interface? I only have 2 images for the buttons pressed and depressed.

The included picture (in link) is what one screen of the interface looks like (I will have 4 to 5 screens with different backgrounds and buttons).
Any hint on how to do something like this that wont make me run out of memory?

https://www.dropbox.com/s/ca95z0baezqe0o0/interface_example.jpg?dl=0

I'm at a complete loss on how this is supposed to work.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Have I struck up a limit of B4A or Android itself?
The OS process runs out of available memory.

It should be simple to create such a layout. Just make sure that the images are not too large.

If you are unable to solve it then please start a new thread and upload a small project with only the layout. Upload everything directly to the forum.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
Ok tanks, I think I will rebuild the interface from scratch and see if I can make the layout work without any application code in there aside from menu navigation. The problem might not even be the interface itself, that application seems to have numerous problems. But I really don't understand what you mean by "making sure the images are not too large" the PNG files are as small as they can be in kbytes and i make the views exactly the same size.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
I managed to get rid of my errors by adding the following line in the manifest editor.

B4X:
SetApplicationAttribute(android:largeHeap,"true")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…