【问题标题】:Android - Run another app from my app [duplicate]Android - 从我的应用程序运行另一个应用程序[重复]
【发布时间】:2014-04-09 12:33:21
【问题描述】:

我想在用户点击Buttoninside 我的 Android 应用程序后执行撰写消息 - SMS(Android 手机中的默认应用程序)。

这不可能吗?

【问题讨论】:

    标签: android sms


    【解决方案1】:

    您可以使用以下代码在 android 中发送短信:

    Intent smsIntent = new Intent(Intent.ACTION_VIEW);
    smsIntent.setData(Uri.parse("smsto:"));
    smsIntent.setType("vnd.android-dir/mms-sms");
    
    smsIntent.putExtra("address"  , new String ("0123456789"));
    smsIntent.putExtra("sms_body"  , "Test SMS Body");
    try {
        startActivity(smsIntent);
        finish();
        Log.i("Finished sending SMS...", "");
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(MainActivity.this, 
        "SMS faild, please try again later.", Toast.LENGTH_SHORT).show();
    }
    

    希望对你有所帮助..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多