getIntent - How to Receive an Intent in your Activity

Activity.getIntent was added in API Level 1

Return the intent that started this activity.
This method retrieves any incoming intent to the activity.

1. Start an Activity named NewActivity.java and newactivity.xml.

2 In NewActivity.java, add the below to the onCreate. This will make sure the intent is not null.

if(getIntent() != null) {
// do stuff here
}

3. Compile and run!

Next Recommended Article: getExtras - How to Retrieve a map of Extended Data from Intent