In android my activity is not stopping when I am returning to the main menu by back buttons.
So i used below code to stop the application from running. But when I hit back button it's showing Unfortunately,application has stopped. So is there a simple way where I stop my application from running when I return to main menu or by back button.
protected void onDestroy() {
this.finish();
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lightsui"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/My_Theme"
>
<activity
android:name="com.example.lightsui.MainActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>