如何使用待定意图启动新活动 [英] How to launch a new activity using pending intent
问题描述
任何人都可以说出如何使用PendingIntent
启动新的Activity
以及如何使用挂起的意图传递值.
预先感谢.
Can anyone please say how to launch a new Activity
using PendingIntent
and also to pass a value using pending intent.
Thanks in advance.
推荐答案
Intent intent = new Intent(getApplicationContext(), ActivityToLaunch.class);
intent.putExtra(<oneOfThePutExtraFunctions>);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
您可以使用以下各种Intent.PutExtra()函数之一将额外的数据添加到Intent中: http://developer.android.com/reference/android/content/Intent.html
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
然后,当您准备启动PendingIntent时,请使用位于以下位置的Send()函数之一: http://developer.android.com/reference/android/app/PendingIntent.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
这篇关于如何使用待定意图启动新活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!