在收件箱Android中保存/创建MMS

|| 我正在开发一个需要能够在收件箱或已发送文件夹中保存/创建新MMS的应用程序,但我无法弄清楚该方式。 我尝试了以下代码,但它给了我例外:
ContentValues values = new ContentValues();
values.put(\"address\", \"xxxxxxxxxxx\");
values.put(\"body\", \"body 3\");
values.put(\"read\", \"0\");
getContentResolver().insert(Uri.parse(\"content://mms/inbox\"), values);
例外是:
ERROR/Database(118): Error inserting read=0 body=body 3 msg_box=1 date=1306153444 address=xxxxxxxxxxx
ERROR/Database(118): android.database.sqlite.SQLiteException: table pdu has no column named body: , while compiling: INSERT INTO pdu(read, body, msg_box, date, address) VALUES(?, ?, ?, ?, ?);
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
ERROR/Database(118):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
ERROR/Database(118):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:36)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1536)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1410)
ERROR/Database(118):     at com.android.providers.telephony.MmsProvider.insert(MmsProvider.java:347)
ERROR/Database(118):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:174)
ERROR/Database(118):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:146)
ERROR/Database(118):     at android.os.Binder.execTransact(Binder.java:288)
ERROR/Database(118):     at dalvik.system.NativeStart.run(Native Method)
ERROR/MmsProvider(118): MmsProvider.insert: failed! read=0 body=body 3 msg_box=1 date=1306153444 address=xxxxxxxxxxx
UDPATE:通过删除以下行删除了异常:
values.put(\"body\",\"body 3\")
但是我看不到消息中的任何彩信。     
已邀请:
我遇到了同样的问题。但是,我成功创建并还原了彩信。它基本上是数据库的反向操作。我希望您可以从数据库中获取彩信,对吗?您只需要在数据库表中放回适当的值即可。您可以在mmssms.db中获取有关数据库表的信息。了解mmssms.db后,插入MMS非常容易。     
MMS的正文存储在
content://mms/part/
中。请参阅此代码以获取如何阅读的信息,但请记住,所有这些都是未记录的,不受支持的,并且可能会更改,恕不另行通知。     
首先,当您创建一个要用作彩信屏幕的屏幕时。 然后,在完成设置后,尝试使用以下代码将此mms发送给您想要的其他人。 在这里,您首先在项目上声明一个btn_email按钮。 btn_email =(按钮)findViewById(R.id.btn_email); 然后在该按钮上编写onclickevent,这将有助于将彩信发送给其他人。 发送彩信代码: btn_email.setOnClickListener(new View.OnClickListener()                 {                     @Override                     public void onClick(View v){                         // TODO自动生成的方法存根                         System.out.println(\“刚刚按下电子邮件按钮。.”“);
                    Intent sendIntent = new Intent(Intent.ACTION_SEND);

                    //Mime type of the attachment (or) u can use sendIntent.setType(\"*/*\")

                    sendIntent.setType(\"image/jpeg\");

                    //Subject for the message or Email

                    sendIntent.putExtra(Intent.EXTRA_SUBJECT, \"My Picture\");

                    //Full Path to the attachment

                    sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(\"file://mnt/\"+mUrl));

                    //Use a chooser to decide whether email or mms

                    startActivity(Intent.createChooser(sendIntent, \"Email:\"));
                }

            });
这是将mms通过您的sdcard路径发送给其他人的代码。 此代码使用的意图代码是android默认的电子邮件发送屏幕将使用的代码。 通过这种方式,您可以将彩信发送给其他人。 现在要保存您发送给其他人的微粒彩信,在开发创建的屏幕时,您只需捕获整个屏幕...并保存在sd卡中。 例如: btn_save =(按钮)findViewById(R.id.btn_save);
   btn_save.setOnClickListener(new OnClickListener()
   {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        System.out.println(\"the save button is just pressed..\");

        saveImageToSD();
        Toast.makeText(Create_Screen_Birthday.this,\"Image successfully saved\",Toast.LENGTH_LONG).show();    
    }

   });
受保护的void saveImageToSD(){         // TODO自动生成的方法存根
    System.out.println(\"NOW you are on the saveimage to sd card method called block..\");

    try
    {
        //String fileName = \"myBitmapImage2.png\";   
        int  Current_Hour,Current_Minute,Current_Second;
        RelativeLayout settext_relative;

        settext_relative = (RelativeLayout)findViewById(R.id.settext_relative);



        final Calendar c = Calendar.getInstance();

        Current_Hour = c.get(Calendar.HOUR);
        Current_Minute = c.get(Calendar.MINUTE);
        Current_Second = c.get(Calendar.SECOND);


        System.out.println(\"the value of Current_Year = \"+Current_Hour);
        System.out.println(\"the value of Current_Month = \"+Current_Minute);
        System.out.println(\"the value of Current_Date = \"+Current_Second);



        fileName = \"Birthday_Card\"+\"_\"+Current_Hour+\"_\"+Current_Minute+\"_\"+Current_Second+\".png\";
        String path = \"/sdcard/E-card/Birthday_Cards/\";

          newfileName = path + fileName;
         System.out.println(\"the value of newfilename = \"+newfileName);


        System.out.println(\"The Filename on save card on sdcard = \"+fileName);

        FileOutputStream outStream = null;
        File file = new File(path);
        file.mkdirs();

        File outputFile = new File(file, fileName);
        outputFile.createNewFile(); 

        outStream = new FileOutputStream(outputFile);

        BufferedOutputStream bos = new BufferedOutputStream(outStream);



         RL.setDrawingCacheEnabled(true);

     bitmap = Bitmap.createBitmap( RL.getDrawingCache());

        bitmap.compress(Bitmap.CompressFormat.PNG, 100,bos);

         RL.setDrawingCacheEnabled(false);

        bos.flush();
        bos.close();

        btn_preview.setVisibility(View.VISIBLE);

        btn_save.setVisibility(View.GONE);
    }

    catch(Exception ex)
    {
        ex.printStackTrace();
    }       

}
上面的代码将保存您已发送的屏幕,然后您只需从sdcard特定路径名访问或获取该图像     

要回复问题请先登录注册