Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getPartOfMMS(int mmsID) {
- String selectionPart = "mid=" + mmsID;
- Uri uri = Uri.parse("content://mms/part");
- Cursor cursor = context.getContentResolver().query(uri, null,
- selectionPart, null, null);
- try {
- if (cursor.moveToFirst()) {
- do {
- String path = cursor.getString(cursor.getColumnIndex(Telephony.Mms.Part._DATA));
- if (path != null) {
- return path;
- }
- } while (cursor.moveToNext());
- }
- return null;
- } finally {
- cursor.close();
- }
- }
- private String getMmsText(int id) {
- String selectionPart = "mid=" + id;
- Uri uri = Uri.parse("content://mms/part");
- Cursor cursor = context.getContentResolver().query(uri, null,
- selectionPart, null, null);
- try {
- if (cursor.moveToFirst()) {
- do {
- String type = cursor.getString(cursor.getColumnIndex(Telephony.Mms.Part.CONTENT_TYPE));
- if ("text/plain".equals(type)) {
- String path = cursor.getString(cursor.getColumnIndex(Telephony.Mms.Part.TEXT));
- if (path != null) {
- return path;
- }
- }
- } while (cursor.moveToNext());
- }
- } finally {
- cursor.close();
- }
- return null;
- }
- private String getMmsType(int id) {
- String selectionPart = "mid=" + id;
- Uri uri = Uri.parse("content://mms/part");
- Cursor cursor = context.getContentResolver().query(uri, null,
- selectionPart, null, null);
- try {
- if (cursor.moveToFirst()) {
- do {
- String type = cursor.getString(cursor.getColumnIndex(Telephony.Mms.Part.CONTENT_TYPE));
- if (!type.equals("application/smil")) {
- return type;
- }
- } while (cursor.moveToNext());
- }
- } finally {
- cursor.close();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement