Search code examples
androidlaunching-application

How to start a new application on Android


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>

Solution

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