I am trying to go back to a previous activity using intents.
The problem I have is with my main page, it is the page that launches the app so when I try to put the name android.intent.action.MAIN as my intent, it gives me the option to open all the apps.
What should I do to fix this? How can I rename my activity name?
Thanks
Here is my Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.AssaultAlarm.full" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="5" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".AssaultAlarmActivity"
android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Info" android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar" android:label="@string/app_name">
<intent-filter>
<action android:name="com.AssaultAlarm.INFO" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".Settings" android:screenOrientation="portrait" android:permission="android.permission.READ_CONTACTS"
android:theme="@android:style/Theme.NoTitleBar" android:label="@string/app_name">
<intent-filter>
<action android:name="com.AssaultAlarm.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
This is how I want to call it
Intent info = new Intent("AssaultAlarmActivity.class");
startActivity(info);
If you want to go to previous activity you can just finish current activity. You will automatically go to previous activity in stack but if you want to go specific activity you can use following.
Why you are not using explicit intent.
If you don’t want to use explicit intent you may add new intent filter for your activity
and
If you want to rename your activity you will do it as follow