I'm Creating an android application with two Activities(Activity1 and Activity2) where I need to open the app in two ways .
Way 1 : By NFC Card
In this way ,I need to open the Activity1. ie., If I swipe the Card I need to open Activity1.
Way 2 : By Icon
In this way,I need to open the Activity 2 .ie., If the user click the icon the Activity2 must be opened .
My AndroidManifest.xml is shown below ,
...............
...............
...............
<activity
android:name=".Activity1"
android:screenOrientation="portrait"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
.......................
.......................
.......................
In Activity1 I just tried to get the type by
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction()))
{
// Here I'm dealing with Activity1.
}
else
{
// Here I've set an Intent to go to Activity2.
}
You can look at else block where I've set an Intent to go to Activity2.But I need to go directly to Activity2 without getting into Activity1.
How to achieve that ? Please help