Create an intent with a given action. All other fields (data, type, class) are null. Note that the action must be in a namespace because Intents are used globally in the system -- for example the system VIEW action is android.intent.action.VIEW; an application's custom action would be something like com.google.app.myapp.CUSTOM_ACTION.
Parameters: action - The Intent action, such as ACTION_VIEW.
1. In the MainActivity.java file, add the below line to the imports section.
import android.content.Intent;
2. Add this line below to the onCreate method. This will create an intent to deliver some data to another app. The new intent is named mySendIntent.
Intent mySendIntent = new Intent(Intent.ACTION_SEND);
3. Compile and run!
4. Other standard activity options are:
ACTION_MAIN, ACTION_VIEW, ACTION_ATTACH_DATA, ACTION_EDIT, ACTION_PICK, ACTION_CHOOSER, ACTION_GET_CONTENT, ACTION_DIAL, ACTION_CALL, ACTION_SEND, ACTION_SENDTO, ACTION_ANSWER, ACTION_INSERT, ACTION_DELETE, ACTION_RUN, ACTION_SYNC, ACTION_PICK_ACTIVITY, ACTION_SEARCH, ACTION_WEB_SEARCH, ACTION_FACTORY_TEST
Next Recommended Article: Intent setType(String type) - How to Set an Explicit MIME data type
Resources:
developer.android.com/reference/android/content/Intent.html#Intent(java.lang.String)