How to clear all activity stack in Android

Normally when we launch new activity, it’s previous activities will be kept in a queue like a stack of activities. So if you want to kill all the previous activities, just follow these methods. Method 1 In API level 11 or greater, use FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK flag on Intent to clear all the activity stack.

Android stop or start adb from command line

Sometimes your android emulator might fails to connect eclipse DDMS tool and ask for adb to start manually. In that case you can start or stop the adb using the command prompt. Method 1 Open the cmd from Start ⇒ run ⇒ cmd and execute these commands. Before you execute the commands in CMD make …

Android Showing and Hiding the views

You can show and hide android views (layout, button, textview etc.,) at any time. You can also use animations like fadeOut or fadeIn to make it more beautiful while hiding and showing the views. Please refer Android Working with XML Animations if you want to add animations to view while hiding/showing. Using view.setVisibility(int) function you …

How to detect Android Back button press

Detecting android device hardware back button / soft back button press is very easy. But be careful while overriding the default back button action as it is not suggested to change the android default user experience. Method 1 Override the onBackPressed() method and take the action inside this function.

Page 2 of 3123