How To Check If App Is Debuggable

This is useful to add logs, unlock levels, bypass security checks and other stuff only when the app is debuggable. This way, you don’t need to remove or comment code when you publish your app. public static boolean isDebuggable(Context context, String...

How To Check If Market Is Installed

Some devices don’t have a market application installed, if you try to open it without checking if it exists, you might get a Force Close! If there is any market application installed on the device, you can: ask for ratings/stars ask for comments redirect users...

How To Change Layout Attributes Automatically

This is very useful to change attributes automatically, without having to change them one by one manually. Examples: change the Color of all TextViews in a Layout change the TypeFace of all TextViews in a Layout change the Background of all Buttons in a Layout change...

How To Improve SoundPool Performance

I had a few performance issues while using SoundPool. Everytime I played a sound, the frame rate dropped. This is absolutelly inadmissible for games requiring a high FPS rate. I’m using *.ogg files and the SoundPool initialization is done during the game...

How To Minimize OutOfMemory Errors

If you are getting “java.lang.OutOfMemoryError: bitmap size exceeds VM budget” errors, you should search your code for memory leaks and fix them. If you already did that and you are still having OutOfMemoryError (OOM), then you could try the solution...

How To Detect Screen Size Bucket

If you need to detect programatically whether you are on a normal screen (phones) or on a large screen (tablets) , you may use the following code: if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) ==...