Android, how to detect that the activity is back from another activity?

For Android, suppose 3 activities, a1 a2 a3, with their click hierarchy, a1->a2->a3. My questions is in a2, how to detect it is from a3 by pressing the back key, instead of entering from a1?

Localization Android

What languages are supported by android for localization with their respective values folder name, the best link i could find was http://developer.android.com/reference/java/util/Locale.html any body can help me with more languages what if we need to support more languages then listed above.

How do I implement a BroadcastReceiver in a Service Class in Android?

I need to implement BroadcastReceiver in a Service class I have created: public class MyService extends Service in this class I have to implement a Simulation of Download by using Thread – Sleep when the user presses the button in the MyActivity Class which implements sendBroadcas(). I cannot extends the Service class to BroadcastReceiver as […]

ActivityUnitTestCase throws RuntimeException when ran with AndroidJUnitRunner

I am trying to integrate Espresso 2.0’s AndoridJUnitRunner with ActivityUnitTestCase. However, my tests are crashing when startActivity() tries to initialize mMockParent = new MockParent(). Here’s what I did: Create a new project with Intellij 14 CE and make some changes to build.gradle. android{ defaultConfig { applicationId “com.noob.testing” minSdkVersion 9 targetSdkVersion 21 versionCode 1 versionName “1.0” […]

Issue with cancelling the AlarmManager – PendingIntent

I have an app which reminds people to do their tasks. So there is one PendingIntent, now the user can delete the alarm when he wants to. In this code, there is just one PendingIntent for multiple user alarms so I am confused on cancelling that particular alarm where the intent extras is “pill”. The […]

Android :EditText loses content on scroll in ListView?

I have list item with EditText in it, I don’t know how many items there will be. I have a problem when I enter some text in EditText, and then scroll down a ListView, after I’ve scroll up again there is no text in my first EditText, or there is some text from other EditText […]

Hide Day, Month, or Year from DatePicker in Android 5.0+ Lollipop

I’ve been searching for a solution to hide any one of the following spinners from the DatePicker. For Android 5.0 the internal variables were changed and, in my case, the Day and Month spinners were visible again after the update to my device. Android 4.4 and Kitkat Solution DatePicker dpDate = (DatePicker) findViewById(R.id.dpDate); // Initialize […]

Android New Intent start particular method

I want to start one of my existing activities and force the activity to call a specific method after it started. Is this possible? Can I define a method that should be called after creating the activity inside my Intent? For example something like: Intent intent = new Intent(this, com.app.max.Home.class.myMethod);

Starting a Song from Spotify Intent

Is there anyway to start a Spotify Track from its URI ? I’ve tried the following approaches but none of them work. When Spotify opens, it always lands in the Playlists page, instead of the track’s player. String spotifyTrackURI = “spotify:track:1cC9YJ8sQjC0T5H1fXMUT2”; Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(“com.spotify.mobile.android.ui”); // I’ve tried with Intent#putExtra().. launchIntent.putExtra( SearchManager.QUERY, spotifyTrackURI ); // […]

Add prebuilt APKs to Android AOSP system.img

I’m building AOSP from source. What I would like to do is to include a few prebuilt files in the generated system.img as part of the make process. I’m trying to find the actual file that creates the system.img and add a few lines there. Any idea? Thank you in advance.

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