0

How can I start a new application on Android? I have done a new applications NewHomeScreen and Hello and on NewHomeScreen I wrote this code.

@Override public void onCreate(Bundle state) {
    super.onCreate(state);
    setContentView(R.layout.main);
    Intent mainIntent = new Intent(this,Hello.class);
    startActivity(mainIntent);
}

However, it does not start Hello application. Debugger says that state has value null but what should it be? I also wrote this to Manifest:

<activity android:name="Hello">
    <intent-filter>
            <action android:name="android.intent.action.HELLO" />
            <category android:name="android.intent.category.HELLO"/>
            <category android:name="android.intent.category.DEFAULT" />
    </intent-filter> 
</activity>

2 Answers2

0

I think you forgot to specify the main Activity in your AndroidManifest.xml file:

 <application android:icon="@drawable/icon">
    <activity android:name="NewHomeScreen" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.HELLO" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Ricardo Amores
  • 4,597
  • 1
  • 31
  • 45
0

Try getting rid of the intent-filter in your Home activity. You don't need it anyway, if it's not your main screen.

Eric Mill
  • 3,455
  • 1
  • 25
  • 26