I have built an Android application with two activities: 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 string.This will get 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, it works perfectly. Then i want to turn back in my LoginActivity using also a link: So next, i did this in 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 goes the problem. In RegisterActivity i have the same "href" value and it will get me to my RegisterActivity again although i want to go back 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 don't know how to make difference between this two activities. Maybe an id or some parameter will help me but i don't know which one. Thank you in advance!I hope someone can help me.