Reputation: 2783
I want to develop an application, the small part of which will search the string of message from an EditText in the Inbox of my device....
I have referred some links like
https://stackoverflow.com/questions/8941228/how-to-read-all-sms-from-inbox-in-android-2-2-and-above
http://androidforums.com/android-applications/1773-how-read-sms-android.html
Read all SMS from a particular sender
but could not make it possible... can anyone plz help me with a useful piece of code...Thanks in Advance.
Upvotes: 1
Views: 1110
Reputation: 2783
I finally got the answer but dont know if its the most efficient solution. Kindly correct me if there is some more efficient solution.
I first checked a particular text from Inbox to the text I inserted in Search Box. And if the text matches then I inserted it into the ArrayList. Finally I print whole ArrayList.
public ArrayList<String> check(String str)
{
boolean fullContainsSub = str.toUpperCase().indexOf(content.toUpperCase()) != -1;
//String styledText = "This is <font color='red'>simple</font>.";
//item.setText(Html.fromHtml(styledText), ListView.BufferType.SPANNABLE);
if(fullContainsSub)
{
itemList.add(str);
}
return itemList;
}
Here str is text from Inbox while content will be search box text.
Upvotes: 1