短信发送以及保存在已发送的框中

时间:2014-03-05 09:11:48

标签: android sms filenotfoundexception

我在android中开发了一个短信应用程序。我想在发送到发送文件夹中的号码时保存短信。但它正在抛出java.io.FileNotFoundException

mPhoneNumber = FriendData.getNumber();
    mMessage=messagetosend.getText().toString();
    SmsManager smManager=SmsManager.getDefault();

    ArrayList<String> parts = smManager.divideMessage(mMessage);

    smManager.sendMultipartTextMessage(mPhoneNumber, null, parts, null, null);

    //String userInput = messagetosend.getText().toString();


    try
    {
    ContentValues values = new ContentValues(); 

        values.put("address", mPhoneNumber); 

        values.put("body", mMessage);
        values.put("date",  DateFormat.getDateTimeInstance().format(new Date()));
        getContentResolver().insert(Uri.parse("content://sms/sent"), values);
        //Uri uri = getContentResolver().insert(Uri.parse("content://sms/sent"), values);
        //InputStream stream = getContentResolver().openInputStream(uri);
        // Toast.makeText(getApplicationContext(), stream.toString(), Toast.LENGTH_LONG).show();
        Calendar c = Calendar.getInstance();
        SenderMessages(mMessage, c.getTimeInMillis());
        messagetosend.setText("");
         Toast.makeText(getApplicationContext(), " Message Sent", Toast.LENGTH_LONG).show();
    //  finish();

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




     }

,例外是

 java.io.FileNotFoundException: No files supported by provider at content://sms/125

0 个答案:

没有答案