Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 103

Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
07/19/16 06:37 PM (8 years ago)

Menu Image Rows in Android - performance and width

Hi, I'm using with Menu Image Rows plugin in some screens of my app, it's working fine in iOS but in Android there are two issues: 1) Images does not appear in fullwidth of the device, there are spaces on each side of the screen. In iOS (iPad and iPhone) the rows appear in fullwidth. I'm using the same size of images in Android and iOS, the images are png 1536x480 pixels, as it was recommended in another post I saw in the past. Should the images have another resolution in Android? Or is there any configuration in Android that would fix the images to fullwidth? 2) In Android the app closes after navigating through some screens with Menu Image Rows. In iOS it also happened, but after I reduced the images file size from 100 KB to about 20 KB each (by reducing colors), it doesn't close the app anymore, but in Android it does. I know there are differences in the S.O, but as a reference, tests in Android were made in version 4.2.2 in a Sony Xperia L that I found it has 1 GB RAM and tests in iOS were made in iPhone 4S that has 512 MB RAM. Does anyone experience something similar while using Menu Image Rows. Any advice to try to fix this issue? Thanks!
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/19/16 07:00 PM (8 years ago)
how many items on each menu ,how many screens with that menu?average?
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
07/19/16 07:15 PM (8 years ago)
Hi CMCOFFEE, Average is 4 or 5 rows each screen, but one of them has 14 rows. Total 39 rows. But even if I do not navigate in that screen that has 14 rows the app closes. These are the numbers: - Main menu: 5 rows that open the following screens: - Screen 1: 14 rows - Screen 2: 4 rows - Screen 3: 4 rows - Screen 4: 4 rows / last row calls another screen with more 4 rows - Screen 5: 4 rows Thanks!
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
07/20/16 02:18 AM (8 years ago)
I always had problems with the image rows in android, not in ios, i know that turning (use large heaps) to on, in the manifest, helped with the crashing problems, Sean
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
07/21/16 04:37 AM (8 years ago)
Thanks FunkyMonkey, I will test with that parameter activated.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/22/16 03:07 AM (8 years ago)
I have this problem too. My belief is it affects all the menu's I have tried. I believe it is something inherent in the way images are handled in Android and Buzztouch. I don't know how to fix it completely, but I have some tips: Android manages the memory dynamically. When your app loads a menu with images, it uses up memory and sometimes Android doesn't allocate enough so the app crashes, because it is out of memory. I used this link to add some debug code to prove this : http://stackoverflow.com/questions/3170691/how-to-get-current-memory-usage-in-android. By looking at memory usage, I also worked out there is a slow memory leak when you load menu images frome a remote URL, but not if the images are local. So keeping your images local, in the project build, helps stability. Some devices allocate more memory to an app than others, so your app may appear more stable on some devices than others. Keeping your images as small as possible means they will use less memory and so that helps. Put your images through http://tinypng.com and see if that helps makethem smaller. It usually does. I don't know if .png's are more relaiable than .jpg's, might be worth experimenting. Setting android: largeHeap="true" to the application tag in your manifest file helps, because it gives your app a bit more memory to start with. Hope that helps, Alan
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
07/25/16 03:05 AM (8 years ago)
Setting largeHeap="true" helped. The app still closes but it takes much longer to happen. I will work on the other suggestions. Maybe eliminate some screens with Menu Image Rows and recreate them with other plugin. Thanks!
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/26/16 12:02 PM (8 years ago)
Java has always been known for using alot of memory. A better way is to change from a listview to the recyclerview. That would require some coding changes, but pretty easy. Im doing this for my plugins that use list views, and Im going to open source them soon on github. Also you need to change the way the app handles images. All of this is in Google's Android documentation. https://developer.android.com/training/displaying-bitmaps/index.html
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.