I am trying to develop a SMS counter app in which I want to count all SMS of the present date. i don’t want to count total inbox SMS. I am using following code but not getting the exact result. It’s counting total inbox SMS.
TextView view = new TextView(this);
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
/*
int nsm = 0;
while(cur.moveToNext()){
nsm+= + cur.getCount();
}
*/
String sms = "";
while ( cur.moveToNext());{
// sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
// sms += cur.getString(2);
sms += "Total SMS in the INBOX : "+cur.getCount();
}
view.setText(sms);
setContentView(view);
I am a new learner. Thanks in advance.
This is the Exact resul what i wanted thanks for giving me quick reply