假设一个Activity支持多个Intent, 比如, SMS VIEW Activity支持 SMS VIEW和 SMS EDIT两个Intent。那么,当该Activity被启动时,在其OnCreate处可以通过GetIntent来区分Intent,这个没有问题。 但是,假设该Activity实例已经创建了, 然后被Pause, 然后在新的Activity中,又去启动SMS VIEW Activity了, 这时,由于SMS VIEW Activity已经在task中,所以,应该不会被创建,而是直接被Resume,此时,难道在Resume时也要去GetIntent??关键问题是, Activity第一次启动时,可以通过GetIntent来获取Intent, 然后,如果有其他的Activity再次启动已经存在的Activity时,此时如何获取Intent那???
protected void onNewIntent(Intent intent)
重载onNewIntent,里面的参数就是新的Intent!
需要注意的就是
@Override
protected void onNewIntent(Intent intent);
super.onNewIntent(intent);
setIntent(intent);
protected void onNewIntent(Intent intent)
重载onNewIntent,里面的参数就是新的Intent!当activity已经在堆栈中的时候,不会再次进入onCreate 直接进入onNewIntent然后onResume