android学习笔记之Intent

Intent的基本作用

1、Component name 启动的ActivityServiceBroadcastReceiver等的名字

2、Action 指定另一个Activity要做的动作,如果ACTION_CALLACTION_EDIT

3、Data Uri

4、Category

5、Extras  键值对

6、Flags

 

Intent intent = new Intent();

intent.putExtra(“testIntent”, “123”);  //传值

Intent.setClass(Activity02.this, OtherActivity.class);

Activity02.this.StartActivity(intent); //启动OtherActivity

 

OtherActivity中取得

Intent intent = getIntent();

String value = intent.getStringExtra(“testIntent”);

 

启动发短信的Activity

Uri uri = Uri.parse(“smsto://0800000123”);

Intent intent = new Intent(Intent.ACTION_SENDTO, uri);

Intent.putExtra(“sms_body”, “The SMS text”);

startActivity(intent);

 

你可能感兴趣的:(android,String,service,action,sms)