Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - how to find the name of the main activity of an application?

For example, I want to start Gmail in code/command line, but I don't know its main activity name.

am start -n com.google.android.gm/.XXXXX

It's available through decompiling the apk, but it's difficult.

like image 965
pengguang001 Avatar asked May 11 '11 13:05

pengguang001


People also ask

How do I find my android activity name?

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. xml.

What is main activity in Android?

Typically, one activity in an app is specified as the main activity, which is the first screen to appear when the user launches the app. Each activity can then start another activity in order to perform different actions.

Can we change the name of main activity in Android?

Yes, you can change the name of MainActivity by, opening the directory of the java file in android studio, right-click on it and find refactor, then rename, put in the name you like then click on refactor.

What is name for parts of activity in Android?

An activity represents a single screen with a user interface just like window or frame of Java. Android activity is the subclass of ContextThemeWrapper class. The Activity class defines the following call backs i.e. events. You don't need to implement all the callbacks methods.

How do I get an application package name?

You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com.


2 Answers

This can be found in the application's manifest.

The main activity is the activity with the intent-filter whose name is android.intent.action.MAIN.

like image 187
Tony the Pony Avatar answered Oct 20 '22 00:10

Tony the Pony


Just go to Android package n open Android Manifest File n check out this activity element

<activity>
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
</activity>
like image 20
Ajit Gupta Avatar answered Oct 20 '22 00:10

Ajit Gupta