What is the format for an android intent?

人走茶凉 提交于 2019-12-13 17:14:51

问题


I'd like to know what is the format for an android intent. IE, what should I pass to the method :

getBaseContext().startService(Intent);

If I want to pass this:

android.provider.CallLog.Calls.CONTENT_URI

can i? What would be the format.

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).

Thanks!


回答1:


Just to call a new Activity this is the method.

startActivity(new Intent(this, MYACtivityClass.class));

If you want to pass values into the Activity, you need to create a Bundle

Intent a = new Intent(this, MYACtivityClass.class); Bundle b = new Bundle(); b.putBoolean("test", true); a.putExtra("myBundle", b); startActivity(a);



来源:https://stackoverflow.com/questions/4513207/what-is-the-format-for-an-android-intent

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