android how to put start activity code example

Example 1: intent android open activity

Intent intent = new Intent(this, DisplayMessageActivity.class);
        intent.putExtra(key:,value:);
        startActivity(intent);

Example 2: how to change the first activity on android

<activity android:name=".put your started activity name here"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Tags:

Java Example