当消息到达时已经显示列表时,更新SMS收件箱

|| 我正在创建一个必须导入SMS收件箱的应用程序。我的疑问是,当收件箱列表已经显示并且在此期间我收到一条短信时,如何更新列表并在列表中显示到达的短信?先感谢您     
已邀请:
使用SimpleCursorAdapter。试试这个代码:
public class InboxList extends ListActivity{

private ListAdapter adapter;

        private static final Uri SMS_INBOX = Uri.parse(\"content://sms/inbox\");

    public void onCreate(Bundle bundle) {

        super.onCreate(bundle);

        Cursor c = getContentResolver().query(SMS_INBOX, null, null, null, null);

        startManagingCursor(c);




    String[] columns = new String[] { \"address\",\"body\"};



    int[] names = new int[] { android.R.id.text1,android.R.id.text2};

    adapter = new SimpleCursorAdapter(this, R.layout.inboxlist, c, columns,names);

    setListAdapter(adapter);

  }
}
    

要回复问题请先登录注册