• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Addr类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中android.provider.Telephony.Mms.Addr的典型用法代码示例。如果您正苦于以下问题:Java Addr类的具体用法?Java Addr怎么用?Java Addr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Addr类属于android.provider.Telephony.Mms包,在下文中一共展示了Addr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void loadAddress(long msgId, PduHeaders headers) {
    Cursor c = SqliteWrapper.query(mContext, mContentResolver,
            Uri.parse("content://mms/" + msgId + "/addr"),
            new String[] { Addr.ADDRESS, Addr.CHARSET, Addr.TYPE },
            null, null, null);

    if (c != null) {
        try {
            while (c.moveToNext()) {
                String addr = c.getString(0);
                if (!TextUtils.isEmpty(addr)) {
                    int addrType = c.getInt(2);
                    switch (addrType) {
                        case PduHeaders.FROM:
                            headers.setEncodedStringValue(
                                    new EncodedStringValue(c.getInt(1), getBytes(addr)),
                                    addrType);
                            break;
                        case PduHeaders.TO:
                        case PduHeaders.CC:
                        case PduHeaders.BCC:
                            headers.appendEncodedStringValue(
                                    new EncodedStringValue(c.getInt(1), getBytes(addr)),
                                    addrType);
                            break;
                        default:
                            Log.e(TAG, "Unknown address type: " + addrType);
                            break;
                    }
                }
            }
        } finally {
            c.close();
        }
    }
}
 

开发者ID:ivanovpv,
项目名称:darksms,
代码行数:37,
代码来源:PduPersister.java

示例2: persistAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void persistAddress(
        long msgId, int type, EncodedStringValue[] array) {
    ContentValues values = new ContentValues(3);

    for (EncodedStringValue addr : array) {
        values.clear(); // Clear all values first.
        values.put(Addr.ADDRESS, toIsoString(addr.getTextString()));
        values.put(Addr.CHARSET, addr.getCharacterSet());
        values.put(Addr.TYPE, type);

        Uri uri = Uri.parse("content://mms/" + msgId + "/addr");
        SqliteWrapper.insert(mContext, mContentResolver, uri, values);
    }
}
 

开发者ID:ivanovpv,
项目名称:darksms,
代码行数:15,
代码来源:PduPersister.java

示例3: updateAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void updateAddress(
        long msgId, int type, EncodedStringValue[] array) {
    // Delete old address information and then insert new ones.
    SqliteWrapper.delete(mContext, mContentResolver,
            Uri.parse("content://mms/" + msgId + "/addr"),
            Addr.TYPE + "=" + type, null);

    persistAddress(msgId, type, array);
}
 

开发者ID:ivanovpv,
项目名称:darksms,
代码行数:10,
代码来源:PduPersister.java

示例4: getFrom

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
public static String getFrom(Context context, Uri uri) {
    String msgId = uri.getLastPathSegment();
    Uri.Builder builder = Mms.CONTENT_URI.buildUpon();

    builder.appendPath(msgId).appendPath("addr");

    Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
            builder.build(), new String[]{Addr.ADDRESS, Addr.CHARSET},
            Addr.TYPE + "=" + PduHeaders.FROM, null, null);

    if (cursor != null) {
        try {
            if (cursor.moveToFirst()) {
                String from = cursor.getString(0);

                if (!TextUtils.isEmpty(from)) {
                    byte[] bytes = PduPersister.getBytes(from);
                    int charset = cursor.getInt(1);
                    return new EncodedStringValue(charset, bytes).getString();
                }
            }
        } finally {
            cursor.close();
        }
    }
    return context.getString(R.string.hidden_sender_address);
}
 

开发者ID:moezbhatti,
项目名称:qksms,
代码行数:28,
代码来源:AddressUtils.java

示例5: loadAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void loadAddress(long msgId, PduHeaders headers) {
    Cursor c = mContentResolver.query(
            Uri.parse("content://mms/" + msgId + "/addr"),
            new String[] { Addr.ADDRESS, Addr.CHARSET, Addr.TYPE },
            null, null, null);
    if (c != null) {
        try {
            while (c.moveToNext()) {
                String addr = c.getString(0);
                if (!TextUtils.isEmpty(addr)) {
                    int addrType = c.getInt(2);
                    switch (addrType) {
                        case PduHeaders.FROM:
                            headers.setEncodedStringValue(
                                    new EncodedStringValue(c.getInt(1), getBytes(addr)),
                                    addrType);
                            break;
                        case PduHeaders.TO:
                        case PduHeaders.CC:
                        case PduHeaders.BCC:
                            headers.appendEncodedStringValue(
                                    new EncodedStringValue(c.getInt(1), getBytes(addr)),
                                    addrType);
                            break;
                        default:
                            Log.e(TAG, "Unknown address type: " + addrType);
                            break;
                    }
                }
            }
        } finally {
            c.close();
        }
    }
}
 

开发者ID:Xlythe,
项目名称:AndroidTextManager,
代码行数:36,
代码来源:PduPersister.java

示例6: persistAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void persistAddress(
        long msgId, int type, EncodedStringValue[] array) {
    ContentValues values = new ContentValues(3);
    for (EncodedStringValue addr : array) {
        values.clear(); // Clear all values first.
        values.put(Addr.ADDRESS, toIsoString(addr.getTextString()));
        values.put(Addr.CHARSET, addr.getCharacterSet());
        values.put(Addr.TYPE, type);
        Uri uri = Uri.parse("content://mms/" + msgId + "/addr");
        mContentResolver.insert(uri, values);

        // TODO: add values to a seperate db for faster loading
    }
}
 

开发者ID:Xlythe,
项目名称:AndroidTextManager,
代码行数:15,
代码来源:PduPersister.java

示例7: updateAddress

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
private void updateAddress(
        long msgId, int type, EncodedStringValue[] array) {
    // Delete old address information and then insert new ones.
    mContentResolver.delete(
            Uri.parse("content://mms/" + msgId + "/addr"),
            Addr.TYPE + "=" + type, null);
    persistAddress(msgId, type, array);
}
 

开发者ID:Xlythe,
项目名称:AndroidTextManager,
代码行数:9,
代码来源:PduPersister.java

示例8: getFrom

点赞 2

import android.provider.Telephony.Mms.Addr; //导入依赖的package包/类
public static String getFrom(Context context, Uri uri) {
    String msgId = uri.getLastPathSegment();
    Uri.Builder builder = Mms.CONTENT_URI.buildUpon();

    builder.appendPath(msgId).appendPath("addr");

    Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
                        builder.build(), new String[] {Addr.ADDRESS, Addr.CHARSET},
                        Addr.TYPE + "=" + PduHeaders.FROM, null, null);

    if (cursor != null) {
        try {
            if (cursor.moveToFirst()) {
                String from = cursor.getString(0);

                if (!TextUtils.isEmpty(from)) {
                    byte[] bytes = PduPersister.getBytes(from);
                    int charset = cursor.getInt(1);
                    return new EncodedStringValue(charset, bytes)
                            .getString();
                }
            }
        } finally {
            cursor.close();
        }
    }
    return context.getString(R.string.hidden_sender_address);
}
 

开发者ID:CommonQ,
项目名称:sms_DualCard,
代码行数:29,
代码来源:AddressUtils.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)