How to simulate hardware media control buttons on an Android emulator

Android supports hardware play / pause buttons on headsets and attached devices. I am trying to find a way to test support for those devices on an emulator. The Android documentation talks about how to add support for hardware playback controls, but, unfortunately, I can’t find documentation of how to emulate them. Thanks!

Check if my App is running in Android

I have an application which involves sound pool – On start of the application all the sounds are loaded after which main screen is loaded. Now, I would like to check if the application is running – if is not running I would like to reload the application – if it is running I don’t […]

Modifying or Changing Min, Max and Displayed values for NumberPicker

I have a number picker for minutes. Initially I set displayed values to 15minute intervals. ie, 0,15,30, 45 which means Min is 1 and max is 4. On user selecting a menu option, I want to dynamically change the same Number picker to have 5 minute intervals which means displayed values will be 0,5,10… 50,55 […]

Use C library in Android over NDK

What I want to do: I’ve found a C library which computes an audio stream’s pitch and want to use it in Android. I thought instead of porting it I could also use it with the help of the NDK, right? How does this work? I have to install the NDK, of course, and then? […]

Can't install Android ADT to Eclipse Helios (Windows)

Can’t install Android ADT to Eclipe Helios causing errors: Cannot complete the install because of a conflicting dependency. Software being installed: Android Development Tools 16.0.1.v201112150204-238534 (com.android.ide.eclipse.adt.feature.group 16.0.1.v201112150204-238534) Software currently installed: Eclipse IDE for Java Developers 1.3.1.20100916-1202 (epp.package.java 1.3.1.20100916-1202) Only one of the following can be installed at once: Eclipse UI 3.7.0.I20110602-0100 (org.eclipse.ui 3.7.0.I20110602-0100) Eclipse UI […]

Center the text in the circle

I have to draw a circle with a number in each piece of my circle. My problem is i can’t center the text where i want. Why the center to draw the text is not the same than the center to draw the line ??? the output of my software is the Link to the […]

Android Google Maps Api V2, getting the coordinates for the current map center

I am using Android Google Maps Api V2 (not MapView or MapActivity) and I am having difficulty getting the coordinates for the center of the map. I was thinking of using @Override public void onCameraChange(CameraPosition arg0) { // TODO Auto-generated method stub geoCodeCenter(/*Location object*/); } but I can’t get the lat/long from the CameraPosition object. […]

android capture video frame

I need to get a frame of a video file (it may be on sdcard, cache dir or app dir). I have package android.media in my application and inside I have class MediaMetadataRetriever. To get first frame into a bitmap, I use code: public static Bitmap getVideoFrame(Context context, Uri videoUri) { MediaMetadataRetriever retriever = new […]

NoClassDefFoundError When Using Dagger 2 After Switching to Android Studio 2.0

Before upgrading to Android Studio 2.0 I could use Dagger 2 no problem. Now I am getting a NoClassDefFoundError This has shut me down for more than a day and I’m reaching out for some help. It seems as though Gradle cannot my AppModule class even though it is pretty clear that it is in […]

Android : Get day of the week from date?

How can i format the date to be like this Mon, 27 Nov 2011 public static String sFleTimeToDate(double ft) { double date = ft / 10000 – 11644455600000L; date += TimeZone.getDefault().getOffset((long) date); return DateFormat.format(“ddd, dd MMM yyyy”, new Date((long) date)).toString(); } but this function return 027, 27 Nov 2011

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.