Reputation: 5876
I have built an application with one activity for android. I now want to add a LOGIN page which should be run first. how can I change the application to run login first?
my first activity was MainActivity.java. I went to the application's properties -> run/debug settings -> edit conf. -> Launch action. But there is only Mainactivity, I cannot see Login activity.
I am using Eclipse, by the way.
Is there an easy way to fix this?
Upvotes: 2
Views: 495
Reputation: 83048
Modify the manifest:
<activity
android:name=".YOUR_LOGIN_ACTIVITY"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and modify entry of MainActivity as
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>
Update
You should read Declaring the activity in the manifest and use of intent filters for more. [Search for 'Using intent filters']
Upvotes: 8
Reputation: 355
Inside your AndroidManifest change following line: android:name="com.example.webviewdemo.MainActivity" put your login Activity with including package name like com.example.login.LoginActivity.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.webviewdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.webviewdemo.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>
Upvotes: 1