Joke Collection Website - Public benefit messages - How to delete SMS in Android development

How to delete SMS in Android development

1: Get provider resolver: contentresolver = getcontentresolver ();

2.set uri:uri uri = uri . parse(" content://SMS ")。

3. Execute the deletion method: contentresolver.delete (uri, null, null);

It seems that you don't want to delete them all. Do you want to delete one?

Your two methods:

MRE solver . delete(uri . parse(" content://SMS/" " _ id = "+id,null));

MRE solver . delete(uri . parse(" content://SMS/" " thread _ id = "+threadId,null));

The first parameter uri, the second parameter: condition, and the third parameter: the value of condition:

MRE solver . delete(uri . parse(" content://SMS/" " _ id =?" , the new string [] {"XXX"});

MRE solver . delete(uri . parse(" content://SMS/"," thread_id=?" ,new String[]{ " XXX " }));

Do you need to use it here? : Placeholder.

Be familiar with the parameters of sql statements and methods.