編輯:Android開發實例
- import android.database.Cursor;
- import android.net.Uri;
- import android.util.Log;
- public class DeleteMessage {
- private PegaSocket2 deleteMessage;
- private int idelete;
- private Cursor eventCursor, remindersCursor;
- private int[] column = new int[1];
- private String[] threadid = new String[1];
- private Cursor querymessage;
- DeleteMessage(PegaSocket2 deleteMessage, int id) {
- this.deleteMessage = deleteMessage;
- idelete = id;
- String uriInbox = "content://sms";
- String[] projection = new String[] { "thread_id" };
- Uri uriSms = Uri.parse(uriInbox);
- String where = "_id = " + Integer.toString(idelete);
- querymessage = deleteMessage.getContentResolver().query(uriSms,
- projection, where, null, null);
- }
- private void MoveToFirst() {
- querymessage.moveToFirst();
- }
- public int DeleteShortMessage() {
- if (querymessage.getCount() != 0) {
- MoveToFirst();
- threadid[0] = "thread_id";
- column[0] = querymessage.getColumnIndex("thread_id");
- threadid[0] = querymessage.getString(column[0]);
- // delete message
- int number = deleteMessage.getContentResolver().delete(
- Uri.parse("content://sms/conversations/" + threadid[0]),
- "_id = " + idelete, null);
- Log.e("delete_number", Integer.toString(number));
- if (number != 0)
- return 1;
- else
- return 0;
- } else {
- Log.e("number", "cann't fine the message!");
- return 0;
- }
- }
- }
通過主鍵id來找到他對應的thread_id。然後進行刪除就可以了
可以顯示在的Android任務,通過加載進度條的進展。進度條有兩種形狀。加載欄和加載微調(spinner)。在本章中,我們將討論微調(spinner)。Spinner 用
什麼是變量? 在計算機中用來存儲信息,通過聲明語句來指明存儲位置和所需空間。 變量的聲明方法及賦值 分號:語句結束標志 賦值號:將=右邊的值賦給左邊的變量 變量
什麼是Android UDP? UDP是User Datagram Protocol的簡稱,中文名是用戶數據包協議,是OSI參考模型中一種無連接的傳輸層協議,提供
登錄應用程序的屏幕,詢問憑據登錄到一些特定的應用。可能需要登錄到Facebook,微博等本章介紹了,如何創建一個登錄界面,以及如何管理安全問題和錯誤嘗試。首先,必須定義兩