如何使用待定意图启动新活动 [英] How to launch a new activity using pending intent

查看:67
本文介绍了如何使用待定意图启动新活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以说出如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆