How to launch a new activity using pending intent

半世苍凉 提交于 2019-12-04 16:56:51

问题


Can anyone please say how to launch a new activity using pending intent and also to pass a value using pending intent. Thanks in advance.


回答1:


Intent intent = new Intent(getApplicationContext(), ActivityToLaunch.class);
intent.putExtra(<oneOfThePutExtraFunctions>);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);

You can add extra data into an Intent by using one of the various Intent.PutExtra() functions located: http://developer.android.com/reference/android/content/Intent.html

Then, when you are ready to launch your PendingIntent, use one of the Send() functions located: http://developer.android.com/reference/android/app/PendingIntent.html



来源:https://stackoverflow.com/questions/7896672/how-to-launch-a-new-activity-using-pending-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!