import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;
public class SMSActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
Uri url = Uri.parse("content://sms/inbox");
Cursor cursor = getContentResolver().query(url, null, null, null,null);
String smsdisplay = "";
while (cursor.moveToNext()) {
smsdisplay += "From :" + cursor.getString(2) + " : " + cursor.getString(11)+"\n";
}
textview.setText(smsdisplay);
setContentView(textview);
}
}
in the AndroidManifest.xml
Gives this Permission for Reading SMS in your activity.
No comments:
Post a Comment