tags:

views:

484

answers:

2

Hi,

Is there a way to open up the Messaging Activity on android with a specify SMS? Thank you.

+1  A: 

I dug this out of the source for the Messaging app (lines 311-315), so I'm pretty sure it'll work, but I don't have any experience with it.

// threadId should be the id of the sms/mms thread you want to view
long threadId = 0; 
Intent i = new Intent("com.android.mms");
i.setData(
        Uri.withAppendedPath(
                i.getData(), Long.toString(threadId)
        )
);
i.setAction(Intent.ACTION_VIEW);
fiXedd
I think 'thread id' is different from 'sms id'?different sms from a same person (each has it own id) can have same thread id.
n179911
+1  A: 

// threadId should be the id of the sms/mms thread you want to view

Intent defineIntent = new Intent(Intent.ACTION_VIEW); 
defineIntent.setData(Uri.parse("content://mms-sms/conversations/"+threadId));  
myActivity.startActivity(defineIntent);

This is the simplest way I found

Valay