FileDocCategorySizeDatePackage
MessagingPreferenceActivity.javaAPI DocAndroid 1.5 API7395Wed May 06 22:42:46 BST 2009com.android.mms.ui

MessagingPreferenceActivity

public class MessagingPreferenceActivity extends android.preference.PreferenceActivity
With this activity, users can set preferences for MMS and SMS and can access and manipulate SMS messages stored on the SIM.

Fields Summary
public static final int
VALUE_CREATION_MODE_RESTRICTED
public static final int
VALUE_CREATION_MODE_WARNING
public static final int
VALUE_CREATION_MODE_FREE
public static final int
VALUE_RESUBMISSION_MODE_RESTRICTED
public static final int
VALUE_RESUBMISSION_MODE_WARNING
public static final int
VALUE_RESUBMISSION_MODE_FREE
public static final String
COMPRESS_IMAGE_MODE
public static final String
CREATION_MODE
public static final String
MMS_DELIVERY_REPORT_MODE
public static final String
EXPIRY_TIME
public static final String
PRIORITY
public static final String
READ_REPORT_MODE
public static final String
RESUBMISSION_MODE
public static final String
SMS_DELIVERY_REPORT_MODE
public static final String
NOTIFICATION_ENABLED
public static final String
NOTIFICATION_VIBRATE
public static final String
NOTIFICATION_SOUND
public static final String
NOTIFICATION_RINGTONE
public static final String
AUTO_RETRIEVAL
public static final String
RETRIEVAL_DURING_ROAMING
private static final int
MENU_RESTORE_DEFAULTS
Constructors Summary
Methods Summary
public static intconvertContentClass(java.lang.String contentValue)
Given the name of a content class, which must be one of the "pref_entry_values_mms_content_class" values in "res/values/arrays.xml", return the corresponding ID.

        return Integer.parseInt(contentValue);
    
public static intconvertCreationMode(java.lang.String modeName)
Given the name of a creation mode, which must be one of the "pref_entry_values_mms_creation_mode" values in "res/values/arrays.xml", return the corresponding ID.

        if ("creation".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_CREATION_MODE_RESTRICTED;
        } else if ("warning".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_CREATION_MODE_WARNING;
        } else if ("free".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_CREATION_MODE_FREE;
        } else {
            throw new IllegalArgumentException("Unknown MMS creation mode.");
        }
    
public static intconvertExpiryTime(java.lang.String expiryTimeName)
Given the string value of an expiry time from Sharedpreferences, which must be one of the "pref_entry_values_mms_expiry" values in "res/values/arrays.xml", return the corresponding number of seconds.

        return Integer.parseInt(expiryTimeName);
    
public static longconvertMaxMmsSize(java.lang.String maxSize)
Given the string value of a maximum size from Sharedpreferences, which must be one of the "pref_entry_values_mms_max_size" values in "res/values/arrays.xml", return the corresponding number of bytes.

        return Long.parseLong(maxSize);
    
public static intconvertPriorityId(java.lang.String priorityValue)
Given the name of a priority class, which must be one of the "pref_entry_values_mms_priority" values in "res/values/arrays.xml", return the corresponding ID.

        if ("low".equals(priorityValue)) {
            return PduHeaders.PRIORITY_LOW;
        } else if ("medium".equals(priorityValue)) {
            return PduHeaders.PRIORITY_NORMAL;
        } else if ("high".equals(priorityValue)) {
            return PduHeaders.PRIORITY_HIGH;
        } else {
            throw new IllegalArgumentException("Unknown MMS priority.");
        }
    
public static intconvertResubmissionMode(java.lang.String modeName)
Given the name of a resubmission mode, which must be one of the "pref_entry_values_mms_resubmission_mode" values in "res/values/arrays.xml", return the corresponding ID.

        if ("creation".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_RESUBMISSION_MODE_RESTRICTED;
        } else if ("warning".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_RESUBMISSION_MODE_WARNING;
        } else if ("free".equals(modeName)) {
            return MessagingPreferenceActivity.VALUE_RESUBMISSION_MODE_FREE;
        } else {
            throw new IllegalArgumentException("Unknown MMS resubmission mode.");
        }
    
protected voidonCreate(android.os.Bundle icicle)


    
        
        super.onCreate(icicle);
        addPreferencesFromResource(R.xml.preferences);
    
public booleanonCreateOptionsMenu(android.view.Menu menu)

        super.onCreateOptionsMenu(menu);
        menu.clear();
        menu.add(0, MENU_RESTORE_DEFAULTS, 0, R.string.restore_default);
        return true;
    
public booleanonOptionsItemSelected(android.view.MenuItem item)

        switch (item.getItemId()) {
            case MENU_RESTORE_DEFAULTS:
                restoreDefaultPreferences();
                return true;
        }
        return false;
    
private voidrestoreDefaultPreferences()

        PreferenceManager.getDefaultSharedPreferences(this)
                .edit().clear().commit();
        setPreferenceScreen(null);
        addPreferencesFromResource(R.xml.preferences);