Android Question several basic (noobish) questions

Himred

Member
Licensed User
Longtime User
It's me again asking for simple questions I did not found an answer on the huge knowledge base of previous posts.

1: When I use a tablet to go to my app google play page it says "application designed for phones".
This is not the case as it is also designed for tablets.
What should I add to be tagged as designed for tablets too (in the manifest ? in the first # of the code ?)


2: On the google play android console we have counters for crashes, I saw one crash stated as Out of memory, the debug show it is related to bitmaps.
Of course it never happened here (would be too easy to debug, universe like complex situations).
I only load few (<10) small (<10K) bitmaps on my app, so i was surprised by that out of memory error.
About bitmaps should I initialize them only on first time or each time Activity_Create is executed, actually i initialize them on Activity_Create whatever firstime is true or false, is it the right way ?
If you have any advice to help me track down such events, feel free to help.


Thanks for reading and any help you could provide.
 
1. Note that your app is supported by tablets even if you see this message. See this tutorial: Google Play: "Designed for tablet screens"

2. The image file size doesn't really matter. What matters is the image dimensions. You should use LoadBitmapSample if the dimensions are larger than the target view.

Are you using Canvas?
 
Upvote 0
Image are very small (256x256) and they are just as background of labels (but a lot of labels) i can have up to 120 labels with a background image.
 
Upvote 0
android.view.InflateException: Binary XML file line #107: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:606)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
at com.android.internal.app.AlertController.installContent(AlertController.java:240)
at android.app.AlertDialog.onCreate(AlertDialog.java:336)
at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
at android.app.Dialog.show(Dialog.java:257)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:135)
at anywheresoftware.b4a.BA.ShowErrorMsgbox(BA.java:217)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA$2.run(BA.java:277)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4575)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:586)
... 26 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:483)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
at android.content.res.Resources.loadDrawable(Resources.java:1995)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:2785)
at android.view.ViewGroup.<init>(ViewGroup.java:385)
at android.widget.LinearLayout.<init>(LinearLayout.java:174)
at android.widget.LinearLayout.<init>(LinearLayout.java:170)
... 29 more
 
Upvote 0
hmmmm
Thanks Erel.

One question:

if i do mybitmap.initialize(dir,"toto.png")
and later in code I do mybitmap.initialize(dir,"toto2.png") because user changed theme
what happen to first bitmap ? it stays in memory or it is deleted ?
 
Upvote 0
Back
Top