`
helpbs
  • 浏览: 1163213 次
文章分类
社区版块
存档分类
最新评论

intent action 跳转到系统应用,调用系统功能

 
阅读更多
1.从google搜索内容
  Intent intent = new Intent();
  intent.setAction(Intent.ACTION_WEB_SEARCH);
  intent.putExtra(SearchManager.QUERY,"searchString")
  startActivity(intent);

2.浏览网页
  Uri uri = Uri.parse("http://www.google.com");
  Intent it = new Intent(Intent.ACTION_VIEW,uri);
  startActivity(it);

3.显示地图
  Uri uri = Uri.parse("geo:38.899533,-77.036476");
  Intent it = new Intent(Intent.Action_VIEW,uri);
  startActivity(it);

4.路径规划
  Uri uri = Uri.parse("http://maps.google.com/maps?" +
"f=dsaddr=startLat startLng&daddr=endLat endLng&hl=en");
  Intent it = new Intent(Intent.ACTION_VIEW,URI);
  startActivity(it);

5.拨打电话
  Uri uri = Uri.parse("tel:xxxxxx");
  Intent it = new Intent(Intent.ACTION_DIAL, uri);
  startActivity(it);

6.调用发短信的程序
  Intent it = new Intent(Intent.ACTION_VIEW);
  it.putExtra("sms_body", "The SMS text");
  it.setType("vnd.android-dir/mms-sms");
  startActivity(it);

7.发送短信
  Uri uri = Uri.parse("smsto:0800000123");
  Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  it.putExtra("sms_body", "The SMS text");
  startActivity(it);

  String body="this is sms demo";
  Intent mmsintent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("smsto", number, null));
  mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
  mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
  startActivity(mmsintent);

8.发送彩信
  Uri uri = Uri.parse("content://media/external/images/media/23");
  Intent it = new Intent(Intent.ACTION_SEND);
  it.putExtra("sms_body", "some text");
  it.putExtra(Intent.EXTRA_STREAM, uri);
  it.setType("image/png");
  startActivity(it);

  StringBuilder sb = new StringBuilder();
  sb.append("file://");
  sb.append(fd.getAbsoluteFile());
  Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto", number, null));
  // Below extra datas are all optional.
  intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
  intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
  intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, sb.toString());
  intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
  intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
  startActivity(intent);

9.发送Email
  Uri uri = Uri.parse("mailto:xxx@abc.com");
  Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  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"));

10.播放多媒体
  Intent it = new Intent(Intent.ACTION_VIEW);
  Uri uri = Uri.parse("file:///sdcard/song.mp3");
  it.setDataAndType(uri, "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);

11.uninstall apk
  Uri uri = Uri.fromParts("package", strPackageName, null);
  Intent it = new Intent(Intent.ACTION_DELETE, uri);
  startActivity(it);

12.install apk
  Uri installUri = Uri.fromParts("package", "xxx", null);
  returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

13. 打开照相机
  Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
  this.sendBroadcast(i);

  long dateTaken = System.currentTimeMillis();
  String name = createName(dateTaken) + ".jpg";
  fileName = folder + name;
  ContentValues values = new ContentValues();
  values.put(Images.Media.TITLE, fileName);
  values.put("_data", fileName);
  values.put(Images.Media.PICASA_ID, fileName);
  values.put(Images.Media.DISPLAY_NAME, fileName);
  values.put(Images.Media.DESCRIPTION, fileName);
  values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);
Uri photoUri = getContentResolver().insert(
  MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
  Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  inttPhoto.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(inttPhoto, 10);

14.从gallery选取图片
  Intent i = new Intent();
  i.setType("image/*");
  i.setAction(Intent.ACTION_GET_CONTENT);
  startActivityForResult(i, 11);

15. 打开录音机
  Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
  startActivity(mi);

16. 打开另一程序
  Intent i = new Intent();
  ComponentName cn = new ComponentName("com.yellowbook.android2",
"com.yellowbook.android2.AndroidSearch");
i.setComponent(cn);
i.setAction("android.intent.action.MAIN");
startActivityForResult(i, RESULT_OK);


分享到:
评论

相关推荐

    Android中调用系统所装的软件打开文件

    intent.setAction(Intent.ACTION_VIEW); //获取文件file的MIME类型 String type = getMIMEType(file); //设置intent的data和Type属性。 intent.setDataAndType(/*uri*/Uri.fromFile(file), type); //...

    Android 应用中跳转到应用市场评分示例

    从当前的app跳转到一个应用商店并且跳转到自己app的详情页面,让用户给自己的App进行评分、评价,从而提高自己App的排名。下面介绍三种方法实现该功能。 方法一:通过系统隐式意图方式去调用应用市场app详情页 try{...

    Android Intent调用 Uri的方法总结

    Android Intent调用 Uri的方法总结 //调用浏览器 Uri uri = Uri.parse(); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it); //显示某个坐标在地图上 Uri uri = Uri.parse(geo:38.899533,-...

    Android调用系统自带浏览器打开网页的实现方法

    在Android中可以调用自带的浏览器,或者指定一个浏览器来打开一个链接。只需要传入一个uri,可以是...Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); 使用以上三行代码就能调用系统自带

    Android调用系统默认浏览器访问的方法

    一、启动android默认浏览器 这样子,android就可以调用起手机默认的浏览器访问。 二、指定相应的浏览器访问 ...intent.setAction(android.intent.action.VIEW); Uri content_url = Uri.parse(); intent.setData(content

    Android 中按home键和跳转到主界面的实例代码

    Intent intent= new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //如果是服务里调用,必须加入new task标识 intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent);...

    实验四-Android基本组件交互实验.doc

    startActivityForResult ——跳转到下一个Activity,而当这个Activity被关闭以后,自动跳转前一个Activity ,并调用onActivityResult( )方法,参数为Intent和requestcode 2. Intent Android基本的设计理念是鼓励...

    android在程序中调用相机并取回照片

    使用android.provider.MediaStore类定义的意图ACTION_...//跳转到程序相机页面 Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, R.string.exti);

    Android 拍照并对照片进行裁剪和压缩实例详解

    Android 拍照并对照片进行裁剪和压缩实例详解 ... // 跳转到系统照相机 Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (cameraIntent.resolveActivity(this.getPackageMana

    Android项目源码一款基于MVP设计模式开发的仿淘宝APP.zip

    Activity跳转时图库时的Intent如下 Intent takePhotoIntent = new Intent( “android.media.action.IMAGE_CAPTURE”); takePhotoIntent.putExtra( MediaStore.EXTRA_OUTPUT, imageUri); 在onActivityResult()方法中...

    Android 开发技巧

    0、ANDROID常用类库说明 6 1、ANDROID文件系统与应用程序架构 7 ...附录2、INTENT ACTION 385 附录3、ANDROID的动作、广播、类别等标志 387 ★★★附带工具包说明 393 1.APK反编译工具.rar 393 2.APK安装工具.rar 393

    Android开发资料合集-World版!

    没有最全,只有更全!!! world版全面开放 ...附录2、INTENT ACTION 385 附录3、ANDROID的动作、广播、类别等标志 387 ★★★附带工具包说明 393 1.APK反编译工具.rar 393 2.APK安装工具.rar 393

Global site tag (gtag.js) - Google Analytics