For instance, I have a few activities within one app, and in order to see a certain activity's UI or whatever, I need to run a certain activity that is not the launcher of the app.
One stupid way is to build a "door" for that activity in the launcher and go inside the activity from the door. However, Is there any better way to run a certain activity alone?
If both application have the same signature (meaning that both APPS are yours and signed with the same key), you can call your other app activity as follows: Intent LaunchIntent = getActivity(). getPackageManager(). getLaunchIntentForPackage(CALC_PACKAGE_NAME); startActivity(LaunchIntent);
If you want to make Login activity your main activity then put the the intent-filter tag inside Login activity. Any activity your want to make your main activity must contain intent-filter tag with action as main and category as launcher.
Very easy. Start by exporting the activity you need to run:
Add android:exported="true"
in the Activity declaration in the Manifest. This is because am
is an external application, and you need to export Activities to allow external application to start them.
Go to "Edit Configurations..." in the "Run" menu.
In the left pane, select your application. In the right pane, in the "General" tab, in the "Launch Options" section, there is a "Launch:" dropdown.
Select "Specified Activity", and enter the name of your activity as it appears in your Manifest.
You can create as many Configurations as you like, and name them according however you like, for example to indicate which activity is being started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With