Android 用Intent调用系统中经常被用到的组件(2)

1. Intent it = new Intent(Intent.ACTION_SEND);
2. it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
3. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
4. it.setType("text/plain");
5. startActivity(Intent.createChooser(it, "Choose Email Client"));  

1. Intent it=new Intent(Intent.ACTION_SEND);  
2. String[] tos={"me@abc.com"};  
3. String[] ccs={"you@abc.com"};  
4. it.putExtra(Intent.EXTRA_EMAIL, tos);  
5. it.putExtra(Intent.EXTRA_CC, ccs);  
6. it.putExtra(Intent.EXTRA_TEXT, "The email body text");  
7. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");  
8. it.setType("message/rfc822");  
9. startActivity(Intent.createChooser(it, "Choose Email Client"));

添加附件

1. Intent it = new Intent(Intent.ACTION_SEND);
2. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
3. it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
4. sendIntent.setType("audio/mp3");
5. startActivity(Intent.createChooser(it, "Choose Email Client"));

播放多媒体

1.  
2. Intent it = new Intent(Intent.ACTION_VIEW);
3. Uri uri = Uri.parse("file:///sdcard/song.mp3");
4. it.setDataAndType(uri, "audio/mp3");
5. startActivity(it);

1. Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. startActivity(it);  

Uninstall 程序

1. Uri uri = Uri.fromParts("package", strPackageName, null);
2. Intent it = new Intent(Intent.ACTION_DELETE, uri);
3. startActivity(it);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwdgjg.html