I am new to android and trying my level best.
I am having an application with three activities, 1 login page 2. Home page 3. Registration Page
The first activity loaded is login when a user gives correct user name and password I am allowing to Home page Here I am facing a problem, when I click back button I am going to the login screen again it should not happen the application has to close.
while creating intent and loading home activity i am using finish() also
I tried onBackPressed() method but it does not work for me
public void onBackPressed() {
// HomeActivity.this.finish();
super.onBackPressed();
}
And my manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Example.MyProject">
<application
android:name=".MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@drawable/abc"
android:label="@string/app_name_display"
android:supportsRtl="true"
android:largeHeap="true"
android:manageSpaceActivity=".LoginActivity"
android:theme="@style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".SyncData" >
</service>
<activity android:name=".HomeActivity"
android:screenOrientation="portrait"/>
<activity android:name=".Registration" />
</application>
</manifest>