In Android, in addition to starting a program from the interface, you can also start the program from the command line, using the command line tool am. the startup method is
# Am start-n package name/package name. activity name
The startup method can be obtained from the AndroidManifest. xml file of each application. Take the calculator as an example:
Code
<?xml version="1.0" encoding=""?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android" package="com.android.calculator2">
<applicationandroid:label="@string/app_name"android:icon="@drawable/icon">
<activity android:name="Calculator" android:theme="@android:style/Theme.Black">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
The start method of the calculator is as follows:
# am start -n com.android.calculator2/com.android.calculator2.Calculator
For the example project HelloActivity, AndroidManifest. xml is as follows:
Code
<?xml version="1.0" encoding=""?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.helloactivity">
<application android:label="Hello, Activity!">
<activity android:name="HelloActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
The startup method is as follows:
# am start -n com.example.android.helloactivity/com.example.android.helloactivity.HelloActivity
Other application startup commands are as follows:
The start method of calendar is as follows:
# am start -n com.android.calendar/com.android.calendar.LaunchActivity
The startup method of AlarmClock is as follows:
# am start -n com.android.alarmclock/com.android.alarmclock.AlarmClock
The startup methods of Music and Video are as follows:
Code
# am start -n com.android.music/com.android.music.MusicBrowserActivity
# am start -n com.android.music/com.android.music.VideoBrowserActivity
# am start -n com.android.music/com.android.music.MediaPlaybackActivity
The start method of Camera (Camera) is as follows:
# am start -n com.android.camera/com.android.camera.Camera
Browser is started as follows:
# am start -n com.android.browser/com.android.browser.BrowserActivity
Generally, an Android Application corresponds to a project. It is worth noting that some projects have multiple activities, while some applications use one project. For example, in the Android interface, Music and Video are two applications, but they all use the packages/apps/Music project. The AndroidManifest. xml file of this project contains different activities ).