Activity 中 Intent 使用方法
- //程序内部进行Intent
- class MyButtonListener implements OnClickListener {
- public void onClick(View arg0) {
- Intent intent= new Intent();
- intent.putExtra("testIntent", "888888");
- intent.setClass(dialog.this, OtherActivity.class); //dialog activity 发Intent 给OtherActivity activity
- dialog.this.startActivity(intent);
- }
- }
- //程序间进行Intent,调用发送短息的activity
- class MyButtonListener implements OnClickListener {
- public void onClick(View arg0) {
- Uri uri = Uri.parse("smsto:13600543522");
- Intent intent= new Intent(Intent.ACTION_SENDTO, uri);
- intent.putExtra("sms_body", "The SMS 888888888888");
- startActivity(intent);
- }