Skip to content Skip to sidebar Skip to footer

Issue On Sending Mms In Android Version 4.0.3

Hi I want to send an MMS through my application.For that my code is void sendMMS() { try { ByteArrayOutputStream bos = new ByteArrayOutputStream();

Solution 1:

Ok I solved the issue.

My new code is

voidsendMMS()
    {
        try
        {
            ByteArrayOutputStreambos=newByteArrayOutputStream();
            Drawabledrawable= imageProduct.getDrawable();
            BitmapbitmapPicked= ((BitmapDrawable) drawable).getBitmap();
            bitmapPicked.compress(CompressFormat.JPEG, 75, bos);
            byte[] image = bos.toByteArray();
            Filefile=newFile(Environment.getExternalStorageDirectory() + File.separator + "test.jpg");
            file.createNewFile();
            // write the bytes in fileFileOutputStreamfo=newFileOutputStream(file);
            fo.write(image);

            Log.i(TAG, "image = " + image);

            IntentintentMMS=newIntent(Intent.ACTION_SEND);
            intentMMS.setType("image/jpg");
            intentMMS.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
            intentMMS.putExtra("sms_body", messageFacebook);
            intentMMS.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
            startActivity(intentMMS);
        } catch (android.content.ActivityNotFoundException ex)
        {
            Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
            ex.printStackTrace();
        } catch (Exception e)
        {
            e.printStackTrace();
        }
    }

Post a Comment for "Issue On Sending Mms In Android Version 4.0.3"