1

我如何在android中发送彩信?

我使用 UI 的代码如下:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("address", "5556");
intent.putExtra("sms_body", "Gudmng !!");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File("/sdcard/sky.png"));
intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set
intent.setType("image/*")
startActivity(intent);

但是发送彩信仍然是例外

ERROR/HierarchicalStateMachine(68): TetherMaster - unhandledMessage: msg.what=3

有什么帮助吗?

4

3 回答 3

2

我不确定您的代码有什么问题,但我已经使用了它并且它有效:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpg");
sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
sendIntent.putExtra("sms_body", "hello");
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivityForResult(sendIntent, 0);

也许您可以合并它并根据您的需要进行更改。

于 2011-03-24T10:26:17.037 回答
1

如果您必须发送带有任何图像的彩信,请使用此代码。

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
        sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
        sendIntent.putExtra("sms_body", "some text"); 
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/image_4.png"));
        sendIntent.setType("image/png");
        startActivity(sendIntent);
于 2013-01-17T09:39:16.497 回答
0
Try this :

   Intent shareIntent = new Intent();
                shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
                shareIntent.setType("image/*");
                shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Chitza Share");
                // shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, data);
                shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, Activity_Home.sharefileUriList);
//            shareIntent.putExtra(Intent.EXTRA_STREAM, (Serializable) sharefileUriList);//pass uri here
                final List<ResolveInfo> activities = activity.getPackageManager().queryIntentActivities(shareIntent, 0);
                List<DialogItem> appNames = new ArrayList<DialogItem>();
                for (ResolveInfo info : activities) {
                    appNames.add(new DialogItem(info.loadLabel(activity.getPackageManager()).toString(),
                            info.loadIcon(activity.getPackageManager())));
                }
于 2019-10-20T04:01:19.213 回答