Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADB - Android - Getting the name of the current activity

Tags:

android

adb

ddms

Is there a way to get the details of the current activity that is running via adb.

like image 527
manugupt1 Avatar asked Nov 02 '12 10:11

manugupt1


People also ask

How do I find my current activity name adb?

In Eclipse with Android device attached go to Window menu > Show View > Other ... use filter text "Windows" to pull up Android > Windows ... show this. The top item in the list is the current activity.

How can I get current activity?

This example demonstrates How to get current activity name in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.

How do I find my package name and activity name?

Step 1: Download “APK Info” app from Google Play Store on your android mobile. Step 4: Click the option “Detailed Information” option. It would show the detailed log for the app. Step 5: Then to find the appActivity name of the app, scroll down to the sub-section “Activities”.


1 Answers

I prefer parsing results of dumpsys window windows over dumpsys activity

adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp' 

Keyguard or Recent tasks list used to not show up as Activities but you were able to see them with mCurrentFocus. I have explained why in this answer.

like image 140
Alex P. Avatar answered Sep 18 '22 16:09

Alex P.