I recently read other people's code and saw the onNewIntent method. I Don't Know What To use. So I will study it. OnNewIntent re-writes the following methods in IntentActivity when calling: onCreate onStart onRestart onResume onPause onStop onDestroy onNewIntent 1. Other applications send Intent. Execute the following methods: I // @ philn (12410 ): onCreateI/@ philn (12410): onStartI/@ philn (12410): onResume Method for sending Intent: Uri uri Uri = Uri. parse ("philn: // blog.163.com"); Intent it = new Intent (Intent. ACTION_VIEW, uri); startActivity (it); 2. Receive Intent declaration: <activity android: name = ". intentActivity "android: LaunchMode = "singleTask" android: label = "@ string/testname"> <intent-filter> <action android: name = "android. intent. action. VIEW "/> <category android: name =" android. intent. category. DEFAULT "/> <category android: name =" android. intent. category. BROWSABLE "/> <data android: scheme =" philn "/> </intent-filter> </activity> 3. If IntentActivity is at the top of the task stack, that is to say, the previously opened Activity is currently in the I/@ philn (12410): onPauseI/@ philn (124 10) if another application sends Intent in onStop status, the execution sequence is: I/@ philn (12410): onNewIntentI/@ philn (12410 ): onRestartI/@ philn (12410): onStartI/@ philn (12410): When onResume is developed for Android applications, it is very easy to start another Activity from one Activity and pass some data to the new Activity, however, when you need to bring the Activity running in the background back to the foreground and transmit some data, there may be a small problem. First, by default, when you start an Activity through Intent, even if the same running Activity already exists, the system will create a new Activity instance and display it. In order not to let the Activity be instantiated multiple times, we need to go through AndroidManifest. xml configures the activity loading mode (launchMode) to implement the single task mode, as shown in the following figure: 1 <activity android: label = "@ string/app_name" android: launchmode = "singleTask" android: name = "Activity1"> 2 </activity> when launchMode is singleTask, an Activity is started through Intent. If the system already has an instance, the system will send the request to this instance, but at this time, the system will no longer call the onCreate method that we normally process the request data, but will call the onNewIntent method, as shown below: 1 protected void onNewIntent (Intent intent) {2 super. onNewIntent (intent); 3 setIntent (intent); // must store the new intent unless getIntent () will return the old one4 processExtraData (); 5} Don't forget, the system may kill the Activity running in the background at any time. If this happens, the system will call the onCreate method instead of the onNewIntent method, A good solution is to call the same data processing method in the onCreate and onNewIntent methods, as shown below: 01 public void onCreate (Bundle savedInstanceState) {02 super. onCreate (savedInstanceState); 03 setContentView (R. layout. main); 04 processExtraData (); 05} 06 07 protected void onNewIntent (Intent intent) {08 super. onNewIntent (intent); 09 setIntent (intent); // must store the new intent unless getIntent () will return the old one10 processExtraData () 11} 12 13 private void processExtraData () {14 Intent intent = getIntent (); 15 // use the data converted ed here16}