码迷,mamicode.com
首页 > 其他好文 > 详细

Intent常用使用汇总

时间:2015-09-12 14:47:44      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:


方法一:调用默认的短信程序
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("vnd.android-dir/mms-sms");
intent.setData(Uri.parse("content://mms-sms/conversations/"));//此为号码,本行应该可以不用
startActivity(intent); 


方法二:调用系统自带的短信程序
Intent intent = new Intent();
intent.setClassName("com.android.mms","com.android.mms.ui.ConversationList");
startActivity(intent);

  //这是点击桌面图标启动相应应用程序的方式,前提是必须知道当前系统的MMS包名及入口类路径。
    private void showMMSViewByPackagePath() {
        Intent intent = new Intent();
        intent.setClassName("com.android.mms",
                "com.android.mms.ui.ConversationList");
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        startActivity(intent);
    }
    //这是Intent-Filter过滤方式,是通用的方式。
    private void showMMSViewByIntentFilter() {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setType("vnd.android-dir/mms-sms");
        // 或改成亦可
        // intent.setType("vnd.android.cursor.dir/mms");
        startActivity(intent);
    }

 

Intent常用使用汇总

标签:

原文地址:http://www.cnblogs.com/softidea/p/4802952.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!