I created an Android application with two actions: LoginActivity and RegisterActivity. I need to switch between them using the "a href" tag. So I did this in my AndroidManifest.xml file.
<activity android:name="com.example.test.RegisterActivity" android:label="@string/app_name" > <intent-filter> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.VIEW" /> <data android:scheme="com.example.test" /> </intent-filter> </activity>
In LoginActivity, I just added the "a" tag to my line. This will lead me to RegisterActivity:
TextView register = (TextView) findViewById(R.id.registerLink); register.setText(Html.fromHtml( "If you don't have an account " + "<a href=\"com.example.test://getApplicationContext\">register</a> ")); register.setMovementMethod(LinkMovementMethod.getInstance());
So far, this works fine. Then I want to return to my LoginActivity using the link also: So, I did this in the AndroidManifest file:
<activity android:name="com.example.test.LoginActivity" 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.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="com.example.test" /> </intent-filter> </activity> <activity
And here is the problem. In RegisterActivity, I have the same "href" value and it will return me to my registration activity again, although I want to return to loginActivity.
login = (TextView)findViewById(R.id.loginLink); login.setText(Html.fromHtml( "If you already have an account please " + "<a href=\"com.example.test://getApplicationContext\">login</a> ")); login.setMovementMethod(LinkMovementMethod.getInstance());
I do not know how to make the difference between these two actions. Maybe id or some parameter will help me, but I don't know which one. Thanks in advance, I hope someone can help me.
source share