What is the format for an android intent?

2019-08-05 20:00发布

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条回答
霸刀☆藐视天下
2楼-- · 2019-08-05 20:41

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

查看更多
登录 后发表回答