WEB开发网
开发学院手机开发Android 开发 Android Intent 用法汇总 阅读

Android Intent 用法汇总

 2010-04-13 06:16:00 来源:WEB开发网   
核心提示:startActivity(it);Intent it = new Intent(Intent.ACTION_SEND);it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");it.putExtra(Intent.EXTRA_TEXT, "The em

startActivity(it);

Intent it = new Intent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");

it.putExtra(Intent.EXTRA_TEXT, "The email body text");

it.setType("text/plain");

startActivity(Intent.createChooser(it, "Choose Email Client"));

Intent it=new Intent(Intent.ACTION_SEND);

String[] tos={"me@abc.com"};

String[] ccs={"you@abc.com"};

it.putExtra(Intent.EXTRA_EMAIL, tos);

it.putExtra(Intent.EXTRA_CC, ccs);

it.putExtra(Intent.EXTRA_TEXT, "The email body text");

it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

it.setType("message/rfc822");

startActivity(Intent.createChooser(it, "Choose Email Client"));

//传送附件

Intent it = new Intent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");

sendIntent.setType("audio/mp3");

startActivity(Intent.createChooser(it, "Choose Email Client"));

播放多媒体

Java代码

Uri uri = Uri.parse("file:///sdcard/song.mp3");

Intent it = new Intent(Intent.ACTION_VIEW, uri);

it.setType("audio/mp3");

startActivity(it);

Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");

Intent it = new Intent(Intent.ACTION_VIEW, uri);

startActivity(it);

Uri uri = Uri.parse("file:///sdcard/song.mp3");

Intent it = new Intent(Intent.ACTION_VIEW, uri);

it.setType("audio/mp3");

startActivity(it);

Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");

Intent it = new Intent(Intent.ACTION_VIEW, uri);

startActivity(it);

Market 相关

Java代码

上一页  1 2 3 4 5  下一页

Tags:Android Intent 用法

编辑录入:coldstar [复制链接] [打 印]
赞助商链接