I have been developing an app which should support multiple screen sizes. It works fine when I run that app on medium size screen(nexus 3.7), but if I run the same code using a small or large screen then the app crashes. Can anyone tell me how to solve this issue?
02-06 21:05:38.384: E/AndroidRuntime(331): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.deepak.alice/com.android.deepak.alice.SwipeOfLetters}: android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
02-06 21:05:38.384: E/AndroidRuntime(331): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
02-06 21:05:38.384: E/AndroidRuntime(331): Caused by: java.lang.reflect.InvocationTargetException
02-06 21:05:38.384: E/AndroidRuntime(331): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
The error seems to be clear:
This means you allocate more memory than you should.
According to the screen issue I would say you are allocating a Bitmap or something else which size depends on the screen size. You should then regard using a maximum size, no matter what the actual screen size is and scale the values up.