Breaking News
Home / Android / Android Snippets (page 3)

Android Snippets

How to build simple Hashmap cache in Android?

The following snippet shows how to build a simple Bitmap Cache in Android: import java.util.HashMap;import android.graphics.Bitmap; // TODO: Auto-generated Javadoc/** * The Class ImageMemoryCache. */public class ImageMemoryCache {     /** The cache. */    private static HashMap<String, Bitmap> cache = new HashMap<String, Bitmap>();     /**     * Gets the image.     *      * @param …

Read More »

How to keep screen from dimming or sleeping in Android?

In order for your application screen  need s to keep the screen from dimming or the processor from sleeping,  you must request this permission. <uses-permission android:name=”android.permission.WAKE_LOCK” /> Specifically if you have a scenario where in Audio is being played using the MediaPlayer and you are invoking the MediaPlayer.setScreenOnWhilePlaying() or MediaPlayer.setWakeMode() …

Read More »
Advertisment ad adsense adlogger