I am using this code to retrieve the SMS from Emulator.After that I need to Post it in to the DropBox.I saved some messages to Emulator, it retrieves two things Number and Body.At the time of retrieval it displays the
Wrong Numbers but correct Body. How to correct the number, I save the numbers in to a variable Number. My code is here, I am using 2.1 version.
code
ContentResolver cr = getContentResolver();
Cursor c = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);
while(c.moveToNext()){
Number = c.getInt(c.getColumnIndexOrThrow("address"));
Body = c.getString(c.getColumnIndexOrThrow("body")).toString();
smslist.add( Number + ":" +"\n"+ Body);
}
itemAdapter.notifyDataSetChanged();
c.close();
Any solution ?
In your code you are using
use
c.getString(c.getColumnIndexOrThrow("address"))Method instead ofgetInt()methodsee below link too, The type column in SMS uri
retrieving number.