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);