Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi i need help i want to know after removing activity as default launcher how to start that activity
Posted

1 solution

That is impossible.
Because as you removed the category of activity as Launcher, the Android system won't be able to understand which activity need to be started when application is requested to be opened.
Therefore you must specify Launcher activity in Manifest.xml file, like this,
XML
<activity android:name=".ExampleActivity" android:icon="@drawable/app_icon">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

To overcome this, you need to use Explicit Intents,
Activities that you don't want to make available to other applications should have no intent filters and you can start them yourself using explicit intents.

Read this Intent[^]
Quote:
Explicit intents specify the component to start by name (the fully-qualified class name). You'll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start. For example, start a new activity in response to a user action or start a service to download a file in the background.

for example,
Intent intent = new Intent(this, SignInActivity.class);
startActivity(intent);


-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900