Code example for Cursor

Methods: getColumnIndexOrThrowgetIntgetLonggetString

0
                ICC_URI, true, simChangeObserver);
    } 
 
    private void copyToPhoneMemory(Cursor cursor) {
        String address = cursor.getString(
                cursor.getColumnIndexOrThrow("address"));
        String body = cursor.getString(cursor.getColumnIndexOrThrow("body"));
        Long date = cursor.getLong(cursor.getColumnIndexOrThrow("date"));
 
        try { 
            if (isIncomingMessage(cursor)) {
                Sms.Inbox.addMessage(mContentResolver, address, body, null, date, true /* read */);
            } else { 
                Sms.Sent.addMessage(mContentResolver, address, body, null, date);
            } 
        } catch (SQLiteException e) {
            SqliteWrapper.checkSQLiteException(this, e);
        } 
    } 
 
    private boolean isIncomingMessage(Cursor cursor) {
        int messageStatus = cursor.getInt(
                cursor.getColumnIndexOrThrow("status"));
 
        return (messageStatus == SmsManager.STATUS_ON_ICC_READ) ||
               (messageStatus == SmsManager.STATUS_ON_ICC_UNREAD);
    } 
 
    private void deleteFromSim(Cursor cursor) {
Contextual code suggestions in your IDE  Get Codota for Java