android - Retrieving SMS messages from Inbox -


I am working on the Android application and I am trying to get the list of messages from the device SMS Inbox. In Inbox, I have 2 messages from a contact number and 1 message from another contact number. However, I'm not just receiving messages from every contact, not all of these.

I'm using the following code

  Recover Public Zero SMS Message () {String Address = ""; String body = ""; Uri Inboxuri = Uri.Parse ("Content: // SMS / Inbox"); String [] reqCols = new string [] {"_id", "address", "body"}; Controller Contender = context.getContentResolver (); Cursor cursor = contentResolver.query (inboxUri, reqCols, blank, empty, zero); Cursor.moveToFirst (); While (cursor.movetynext ()) {address = cursor.getString (cursor.item column index ("address")); Body = cursor.getString (cursor.getColumnIndex ("body")); }}  

Thanks for any help

Get rid of the call cursor. MovoveToFirst (); . You move the cursor to the first place, then you call the call ittox (). You are skipping the first position


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -