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.
 

DonManfred

Expert
Licensed User
Longtime User
without seeing your project (upload it. File-Export as zip) we just can fish...
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
If you compile it, you might not be able to make the program start because it checks for a Uart on the USB port (through a usb to go adapter). I have no idea where to disable this for testing purposes since I didn't made that program, I can look into it if necessary but it will take a while for me to figure this out.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
If I remove

img_us_select
img_us_sel1
img_us_sel2
img_us_sel3
btn_us_sel1
btn_us_sel2
btn_us_sel3

In the designer the program works correctly, but i'm not sure if something that was done before is the problem.

When testing I decided to add image views one at a time (with the appropriate declarations and member generation), compiling each time. When I added the first and second one no problem, as soon as I added the third image view the error showed up. but I didn't do anything different in each steps.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You shouldn't see these messages:

Downsampling image due to lack of memory.
Downsampling image due to lack of memory.
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 4

This means that you are loading very large bitmaps without LoadBitmapResize or LoadBitmapSample and you will soon run out of available memory.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
I'm effectively using PNG files as part of the interface (small buttons and background images) in either panel views or image views and I enable or disable each of them depending on what I want to see for the interface. The biggest images are backgrounds (1280 X 800 which is also the resolution of the tablet we are using, we don't have any other variants) at about 200 kilobytes, and i have only 5 or 6 of them and only 1 enable at any time. Only one background image is enabled at once and a few buttons or small overlay images (most are 10kb and some up to 50kb). I guess I wasn't seeing this problem until I started adding panel views with new images. I'm currently using "StatelisDrawable" in button views for the buttons and image views for static images. Should these types of images for that use need to be loaded in another way?
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
I did carefully matched all views that use images to exactly the same dimensions as the drawing, the image dimensions are basically one to one on the tablet. I still don't understand how the manuel_panel view affects all this if the two issues are related.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I didn't see the link to the project.

This code blocks the main thread and kills your app:
B4X:
Do Until Astreams.IsInitialized
           If (Usb.HasPermission) Then
'           Msgbox(Usb.DeviceInfo, "Device Information")
               Dim dev As Int
               dev = Usb.Open(115200)
           
'           Usb.SetCustomDevice(Usb.DRIVER_PROLIFIC,0x1234,0x1234)
           
               If dev <> Usb.USB_NONE Then           
                   Astreams.Initialize(Usb.GetInputStream, Usb.GetOutputStream, "Astreams")
               End If
           Else
               Usb.RequestPermission
           End If
   Loop

You should also use Net library instead of the very old FTP library.

Once I removed that loop the layout is loaded here properly. It is possible that you are loading too many large images.
 
Upvote 0

Catherine Trudel

Member
Licensed User
Longtime User
When I disable the manuel_panel view the android.view.InflateException error disapears. I have no idea what this means or even how to interpret the logs (posted earlier) to figure out what's wrong. There is only a webview (that displays an html file that is on the tablet) and some navigation buttons in this panel.
 
Upvote 0
Top