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.
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.
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.
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.
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?
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.
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.
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.