什么是一个Android的意图格式? [英] What is the format for an android intent?
问题描述
我想知道什么是一个Android意图的格式。 IE浏览器,我应该传递给方法:
I'd like to know what is the format for an android intent. IE, what should I pass to the method :
getBaseContext()startService(意向);
getBaseContext().startService(Intent);
如果我想通过这样的:
android.provider.CallLog.Calls.CONTENT_URI
android.provider.CallLog.Calls.CONTENT_URI
可以吗?会是什么格式。
can i? What would be the format.
有人能给出如何使用意图,以及如何使用它的服务实现一个很好的解释一样, startService()
或 onStartCommand(意向意图,诠释标志诠释startId)
。
Can someone give a good explanation of how to use Intents, and how to use it on Service implementation, like, startService()
, or onStartCommand (Intent intent, int flags, int startId)
.
谢谢!
推荐答案
只需调用一个新的活动,这是方法。
Just to call a new Activity this is the method.
startActivity(新意图(这一点,MYACtivityClass.class));
startActivity(new Intent(this, MYACtivityClass.class));
如果您希望值传递到活动中,你需要创建一个Bundle
If you want to pass values into the Activity, you need to create a Bundle
意图=新的意图(这一点,
MYACtivityClass.class);束B =新
束(); b.putBoolean(测试,真正的);
a.putExtra(myBundle,B);
startActivity(一);
Intent a = new Intent(this, MYACtivityClass.class); Bundle b = new Bundle(); b.putBoolean("test", true); a.putExtra("myBundle", b); startActivity(a);
这篇关于什么是一个Android的意图格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!