开发者

Restoring the Sms Contents?

I've take SMS Backup using their URI content://sms/inbox with this method Uri.getHost().

And, i've changed this to File format using this .

Now, i need to restore this contents to their Database prop开发者_如何学运维erly. What type of method will i use? Anyone guide me. This will very useful for me. Thanks in Advance.


Check this code for inserting into the SMS content Provider :

ContentValues initialValues = new ContentValues();
initialValues.put("address", "9953834074111");
initialValues.put("date", "1308281011976");
initialValues.put("body", "Body of this");
initialValues.put("type", "1");
getContentResolver().insert(smsuri, initialValues);

Check it whether inserted it or not bu using :

    Cursor cursor1 =  getContentResolver().query(smsuri, null, null, null, null);
    if (cursor1.moveToFirst()) {
        do {
            if((cursor1.getString(cursor1.getColumnIndex("address"))).equalsIgnoreCase("9953834074111")){
                String address = cursor1.getString(cursor1.getColumnIndex("address"));
                String date = cursor1.getString(cursor1.getColumnIndex("date"));
                String body = cursor1.getString(cursor1.getColumnIndex("body"));
                String type = cursor1.getString(cursor1.getColumnIndex("type"));
                Log.v("address",address);
                Log.v("date",date);
                Log.v("body",body);
                Log.v("type",type);
            }
        } while (cursor1.moveToNext());
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜