Example usage for android.preference PreferenceScreen setSummary

List of usage examples for android.preference PreferenceScreen setSummary

Introduction

In this page you can find the example usage for android.preference PreferenceScreen setSummary.

Prototype

public void setSummary(CharSequence summary) 

Source Link

Document

Sets the summary for this Preference with a CharSequence.

Usage

From source file:cc.redpen.ui.fragment.SettingsFragment.java

private void setUpLayout() {
    ListPreference languagePref = getPreference(this, getString(R.string.label_setting_language));
    languagePref.setSummary(languagePref.getEntry());
    PreferenceScreen aboutScreen = getPreference(this, getString(R.string.label_setting_about));
    aboutScreen.setOnPreferenceClickListener(this);
    PreferenceScreen feedbackScreen = getPreference(this, getString(R.string.label_setting_feedback));
    feedbackScreen.setOnPreferenceClickListener(this);
    PreferenceScreen licenceScreen = getPreference(this, getString(R.string.label_setting_licence));
    licenceScreen.setOnPreferenceClickListener(this);
    PreferenceScreen versionScreen = getPreference(this, getString(R.string.label_setting_version));
    versionScreen.setSummary(MetaDataUtil.getVersionName(getContext()));
}

From source file:de.nico.ha_manager.activities.Preferences.java

@SuppressWarnings("deprecation")
private void setBuildInfo() {
    // Get Build Info
    String buildInfo = Utils.getBuildInfo(this);

    // Set Build Info
    PreferenceScreen prefscreen = ((PreferenceScreen) findPreference("pref_about_current_version"));
    prefscreen.setSummary(buildInfo);
    onContentChanged();//from  w  ww. ja v a 2s  .  co  m
}

From source file:org.bitbucket.ntakimura.android.support.fragment.AbstractSettingsFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //addPreferencesFromResource(R.xml.settings);

    Bundle args = new Bundle();
    args.putParcelableArrayList(OpenSourceLicenseFragment.EXTRA_OSS, getOpenSourceSoftware());
    mOssFragment = new OpenSourceLicenseFragment();
    mOssFragment.setArguments(args);//from ww  w  . ja  v  a 2  s. co  m

    Bundle policyArgs = new Bundle();
    policyArgs.putInt(Intent.EXTRA_TITLE, R.string.privacy_policy);
    policyArgs.putInt(Intent.EXTRA_TEXT, R.raw.privacypolicy);
    mPrivacyPolicyFragment = new TextDialogFragment();
    mPrivacyPolicyFragment.setArguments(policyArgs);

    Bundle tosArgs = new Bundle();
    tosArgs.putInt(Intent.EXTRA_TITLE, R.string.terms_of_service);
    //tosArgs.putInt(Intent.EXTRA_TEXT, R.raw.termsofservice);
    mTermsOfServiceFragment = new TextDialogFragment();
    mTermsOfServiceFragment.setArguments(tosArgs);

    PreferenceScreen versionPreferences = (PreferenceScreen) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_about_appinfo));
    try {
        versionPreferences.setSummary((getActivity().getPackageManager()
                .getPackageInfo(getActivity().getPackageName(), 0).versionName));
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

}

From source file:org.deviceconnect.android.client.fragment.AbstractSettingsFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);

    Bundle args = new Bundle();
    args.putParcelableArrayList(OpenSourceLicenseFragment.EXTRA_OSS, getOpenSourceSoftware());
    mOssFragment = new OpenSourceLicenseFragment();
    mOssFragment.setArguments(args);/*from   w  w w  . j ava  2 s. c om*/

    Bundle policyArgs = new Bundle();
    policyArgs.putInt(Intent.EXTRA_TITLE, R.string.privacy_policy);
    policyArgs.putInt(Intent.EXTRA_TEXT, R.raw.privacypolicy);
    mPrivacyPolicyFragment = new TextDialogFragment();
    mPrivacyPolicyFragment.setArguments(policyArgs);

    Bundle tosArgs = new Bundle();
    tosArgs.putInt(Intent.EXTRA_TITLE, R.string.terms_of_service);
    tosArgs.putInt(Intent.EXTRA_TEXT, R.raw.termsofservice);
    mTermsOfServiceFragment = new TextDialogFragment();
    mTermsOfServiceFragment.setArguments(tosArgs);

    PreferenceScreen versionPreferences = (PreferenceScreen) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_about_appinfo));
    try {
        versionPreferences.setSummary((getActivity().getPackageManager()
                .getPackageInfo(getActivity().getPackageName(), 0).versionName));
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    CheckBoxPreference checkBoxSslPreferences = (CheckBoxPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_ssl));
    checkBoxSslPreferences.setOnPreferenceChangeListener(this);

    EditTextPreference editHostPreferences = (EditTextPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_host));
    editHostPreferences.setOnPreferenceChangeListener(this);
    editHostPreferences.setSummary(editHostPreferences.getText());

    EditTextPreference editPortPreferences = (EditTextPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_port));
    editPortPreferences.setOnPreferenceChangeListener(this);
    editPortPreferences.setSummary(editPortPreferences.getText());

    // Local OAuth
    SettingsActivity activity = (SettingsActivity) getActivity();

    EditTextPreference editClientIdPreferences = (EditTextPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_client_id));
    editClientIdPreferences.setSummary(activity.getClientId());

    EditTextPreference editClientSecretPreferences = (EditTextPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_client_secret));
    editClientSecretPreferences.setSummary(activity.getClientSecret());

    EditTextPreference editAccessTokenPreferences = (EditTextPreference) getPreferenceScreen()
            .findPreference(getString(R.string.key_settings_dconn_access_token));
    editAccessTokenPreferences.setSummary(activity.getAccessToken());
}

From source file:com.aokp.romcontrol.github.tasks.GetJSONChangelogTask.java

protected Void doInBackground(Void... unused) {
    HttpClient httpClient = null;/*from   w  ww .j av  a  2s.  c o m*/
    try {
        httpClient = new DefaultHttpClient();
        String url = String.valueOf(STATIC_DEBUG ? "https://raw.github.com/JBirdVegas/tests/master/example.json"
                : mConfig.CHANGELOG_JSON);
        HttpGet requestWebsite = new HttpGet(url);
        Log.d(TAG, "attempting to connect to: " + url);
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        JSONArray projectCommitsArray = new JSONArray(httpClient.execute(requestWebsite, responseHandler));

        // debugging
        if (DEBUG)
            Log.d(TAG, "projectCommitsArray.length() is: " + projectCommitsArray.length());
        if (Config.StaticVars.JSON_SPEW)
            Log.d(TAG, "projectCommitsArray.toString() is: " + projectCommitsArray.toString());

        final ChangelogObject commitObject = new ChangelogObject(new JSONObject());
        for (int i = 0; i < projectCommitsArray.length(); i++) {
            JSONObject projectsObject = (JSONObject) projectCommitsArray.get(i);
            PreferenceScreen newCommitPreference = mCategory.getPreferenceManager()
                    .createPreferenceScreen(mContext);
            commitObject.reParse(projectsObject);
            newCommitPreference.setTitle(commitObject.getSubject());
            newCommitPreference.setSummary(commitObject.getBody());
            newCommitPreference.setKey(commitObject.getCommitHash());
            newCommitPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    mAlertDialog.setCommitAndShow(commitObject);
                    return false;
                }
            });
            mCategory.addPreference(newCommitPreference);
        }
    } catch (HttpResponseException httpError) {
        Log.e(TAG, "bad HTTP response:", httpError);
    } catch (ClientProtocolException e) {
        Log.d(TAG, "client protocal exception:", e);
    } catch (JSONException e) {
        Log.d(TAG, "bad json interaction:", e);
    } catch (IOException e) {
        Log.d(TAG, "io exception:", e);
    } finally {
        if (httpClient != null) {
            httpClient.getConnectionManager().shutdown();
        }
    }
    return null;
}

From source file:be.ppareit.swiftp.gui.PreferenceFragment.java

private void updateLoginInfo() {

    String username = FsSettings.getUserName();
    String password = FsSettings.getPassWord();

    Cat.v("Updating login summary");
    PreferenceScreen loginPreference = findPref("login");
    loginPreference.setSummary(username + " : " + transformPassword(password));
    ((BaseAdapter) loginPreference.getRootAdapter()).notifyDataSetChanged();

    EditTextPreference usernamePref = findPref("username");
    usernamePref.setSummary(username);//ww  w.  j  a v  a 2 s  . com

    EditTextPreference passWordPref = findPref("password");
    passWordPref.setSummary(transformPassword(password));
}

From source file:net.openfiretechnologies.veloxcontrol.github.tasks.GetCommitsInProjectTask.java

protected Void doInBackground(String... params) {
    PROJECT_ = params[0];/*from  w w  w. j  a  va2  s .  co m*/
    LAST_SHA_ = params[1];
    String requestCommits;
    if (LAST_SHA_ == null) {
        mCategory.removeAll();
        requestCommits = String.format(mConfig.INITIAL_COMMITS_REQUEST_FORMAT, PROJECT_);
    } else {
        requestCommits = String.format(mConfig.COMMITS_REQUEST_FORMAT, PROJECT_, LAST_SHA_);
    }
    if (BRANCH_ == null)
        BRANCH_ = DEFAULT_BRANCH;
    try {
        HttpClient httpClient = new DefaultHttpClient();
        Log.i(TAG, "attempting to connect to: " + requestCommits);
        HttpGet requestWebsite = new HttpGet(requestCommits);
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        JSONArray projectCommitsArray = new JSONArray(httpClient.execute(requestWebsite, responseHandler));

        // debugging
        if (DEBUG)
            Log.d(TAG, "projectCommitsArray.length() is: " + projectCommitsArray.length());

        String lastSha = null;
        // make a PreferenceScreen for all commits in package
        for (int i = 0; i < projectCommitsArray.length(); i++) {
            // make an object of each commit
            try {
                final CommitObject commitObject = new GithubObject(projectCommitsArray.getJSONObject(i));
                // if we are looking for the next set the we skip the first commit
                // as it is represented as the last commit from the first commit
                // loading loop
                //if (LAST_SHA_ != null && i == 1) {
                //continue;
                //}
                // debugging
                if (Config.StaticVars.JSON_SPEW)
                    Log.d(TAG, "commitObject.toString() is: " + commitObject.toString());

                PreferenceScreen mCommit = mCategory.getPreferenceManager().createPreferenceScreen(mContext);
                // apply info to our preference screen
                mCommit.setKey(commitObject.getCommitHash());
                mCommit.setTitle(commitObject.getSubject());
                mCommit.setSummary(commitObject.getAuthorName());
                mCommit.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                    @Override
                    public boolean onPreferenceClick(Preference p) {
                        mAlertDialog.setCommitAndShow(commitObject);
                        return true;
                    }
                });
                mCategory.addPreference(mCommit);
                // most recent non null sha hash will be to iterate throught commits list
                if (commitObject.getCommitHash() != null) {
                    lastSha = commitObject.getCommitHash();
                }
            } catch (JSONException je) {
                // no author found for commit
                if (DEBUG)
                    Log.d(TAG, "encountered a null value", je);
            }
        }

        if (projectCommitsArray.length() == 100) {
            // append next 100 commits onClick()
            final PreferenceScreen mNext = mCategory.getPreferenceManager().createPreferenceScreen(mContext);
            mNext.setTitle(mContext.getString(R.string.next_commits_page_title));
            mNext.setSummary(mContext.getString(R.string.next_commits_page_summary));
            final String finalString = lastSha;
            mNext.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference p) {
                    GetCommitsInProjectTask nextList = new GetCommitsInProjectTask(mContext, mCategory,
                            mAlertDialog);
                    Log.d(TAG, "Sending project: " + PROJECT_ + " with last sha of " + finalString);
                    nextList.execute(PROJECT_, finalString);
                    // remove last entry it will be first entry in next list
                    mCategory.removePreference(mCategory.findPreference(finalString));
                    // don't keep in list after we click
                    mCategory.removePreference(mNext);
                    return true;
                }
            });
            mCategory.addPreference(mNext);
        }
    } catch (JSONException je) {
        if (DEBUG)
            Log.e(TAG, "Bad json interaction...", je);
    } catch (IOException ioe) {
        if (DEBUG)
            Log.e(TAG, "IOException...", ioe);
    } catch (NullPointerException ne) {
        if (DEBUG)
            Log.e(TAG, "NullPointer...", ne);
    }
    return null;
}

From source file:com.aokp.romcontrol.github.tasks.GetCommitsInProjectTask.java

protected Void doInBackground(String... params) {
    PROJECT_ = params[0];/* w w  w . ja  v  a2s. c om*/
    LAST_SHA_ = params[1];
    String requestCommits;
    if (LAST_SHA_ == null) {
        mCategory.removeAll();
        requestCommits = String.format(mConfig.INITIAL_COMMITS_REQUEST_FORMAT, PROJECT_);
    } else {
        requestCommits = String.format(mConfig.COMMITS_REQUEST_FORMAT, PROJECT_, LAST_SHA_);
    }
    if (BRANCH_ == null)
        BRANCH_ = DEFAULT_BRANCH;
    try {
        HttpClient httpClient = new DefaultHttpClient();
        Log.i(TAG, "attempting to connect to: " + requestCommits);
        HttpGet requestWebsite = new HttpGet(requestCommits);
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        JSONArray projectCommitsArray = new JSONArray(httpClient.execute(requestWebsite, responseHandler));

        // debugging
        if (DEBUG)
            Log.d(TAG, "projectCommitsArray.length() is: " + projectCommitsArray.length());

        String lastSha = null;
        // make a PreferenceScreen for all commits in package
        for (int i = 0; i < projectCommitsArray.length(); i++) {
            // make an object of each commit
            try {
                final CommitObject commitObject = new GithubObject(projectCommitsArray.getJSONObject(i));
                // if we are looking for the next set the we skip the first commit
                // as it is represented as the last commit from the first commit
                // loading loop
                //if (LAST_SHA_ != null && i == 1) {
                //continue;
                //}
                // debugging
                if (Config.StaticVars.JSON_SPEW)
                    Log.d(TAG, "commitObject.toString() is: " + commitObject.toString());

                if ("merge".contains(commitObject.getSubject().substring(0, 5).toLowerCase()))
                    continue;
                PreferenceScreen mCommit = mCategory.getPreferenceManager().createPreferenceScreen(mContext);
                // apply info to our preference screen
                mCommit.setKey(commitObject.getCommitHash());
                mCommit.setTitle(commitObject.getSubject());
                mCommit.setSummary(commitObject.getAuthorName());
                mCommit.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                    @Override
                    public boolean onPreferenceClick(Preference p) {
                        mAlertDialog.setCommitAndShow(commitObject);
                        return true;
                    }
                });
                mCategory.addPreference(mCommit);
                // most recent non null sha hash will be to iterate throught commits list
                if (commitObject.getCommitHash() != null) {
                    lastSha = commitObject.getCommitHash();
                }
            } catch (JSONException je) {
                // no author found for commit
                if (DEBUG)
                    Log.d(TAG, "encountered a null value", je);
            }
        }

        if (projectCommitsArray.length() == 100) {
            // append next 100 commits onClick()
            final PreferenceScreen mNext = mCategory.getPreferenceManager().createPreferenceScreen(mContext);
            mNext.setTitle(mContext.getString(R.string.next_commits_page_title));
            mNext.setSummary(mContext.getString(R.string.next_commits_page_summary));
            final String finalString = lastSha;
            mNext.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference p) {
                    GetCommitsInProjectTask nextList = new GetCommitsInProjectTask(mContext, mCategory,
                            mAlertDialog);
                    Log.d(TAG, "Sending project: " + PROJECT_ + " with last sha of " + finalString);
                    nextList.execute(PROJECT_, finalString);
                    // remove last entry it will be first entry in next list
                    mCategory.removePreference(mCategory.findPreference(finalString));
                    // don't keep in list after we click
                    mCategory.removePreference(mNext);
                    return true;
                }
            });
            mCategory.addPreference(mNext);
        }
    } catch (JSONException je) {
        if (DEBUG)
            Log.e(TAG, "Bad json interaction...", je);
    } catch (IOException ioe) {
        if (DEBUG)
            Log.e(TAG, "IOException...", ioe);
    } catch (NullPointerException ne) {
        if (DEBUG)
            Log.e(TAG, "NullPointer...", ne);
    }
    return null;
}

From source file:com.ubuntuone.android.files.activity.PreferencesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    mContext = this;

    mTracker = GoogleAnalyticsTracker.getInstance();
    mTracker.start(Analytics.U1F_ACCOUNT, this);
    mTracker.trackPageView(TAG);// ww  w  .  j a v a2s. c  om

    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    // Account category. 

    final Preference username = findPreference(Preferences.USERNAME_KEY);

    final String usernameSummary = Preferences.getString(Preferences.USERNAME_KEY, "(?)");
    username.setSummary(usernameSummary);

    setupOnClickPreference(Pref.INVITE_FRIEND, this);

    final Preference purchaseStorage = findPreference(Pref.PURCHASE_STORAGE);
    purchaseStorage.setOnPreferenceClickListener(mPurchaseStorageListener);

    final Preference upgradePlan = findPreference(Pref.UPGRADE_PLAN);
    upgradePlan.setOnPreferenceClickListener(mLinkListener);

    // Options category.

    final PreferenceScreen mediaUploadScreen = (PreferenceScreen) findPreference(Pref.MEDIA_UPLOAD);
    mediaUploadScreen.setOnPreferenceClickListener(whiteHackClick);

    // Photo Auto Upload

    final CheckBoxPreference photosAutoUploadToggle = (CheckBoxPreference) findPreference(
            Preferences.PHOTO_UPLOAD_ENABLED_KEY);
    photosAutoUploadToggle.setOnPreferenceClickListener(mPhotosAutoUploadToggleListener);

    final Preference photosAutoUploadSources = findPreference(Pref.PHOTOS_AUTO_UPLOAD_SOURCES);
    photosAutoUploadSources.setOnPreferenceClickListener(mPhotosAutoUploadSourcesListener);

    mPhotosAutoUploadDir = (Preference) findPreference(Preferences.PHOTO_UPLOAD_DIR_KEY);
    mPhotosAutoUploadDir.setOnPreferenceClickListener(mPhotosAutoUploadDirListener);
    final String photosAutoUploadDirectory = Preferences.getPhotoUploadDirectory();
    mPhotosAutoUploadDir.setDefaultValue(photosAutoUploadDirectory);
    mPhotosAutoUploadDir.setSummary(photosAutoUploadDirectory);

    final Preference uploadPhotosNow = findPreference(Pref.UPLOAD_PHOTOS_NOW);
    uploadPhotosNow.setOnPreferenceClickListener(mUploadPhotosNowListener);

    final Preference cancelAllUploads = findPreference(Pref.CANCEL_ALL_UPLOADS);
    cancelAllUploads.setOnPreferenceClickListener(mCancelAllUploadsListener);

    // General

    final PreferenceScreen advancedOptionsScreen = (PreferenceScreen) findPreference(Pref.ADVANCED_OPTIONS);
    advancedOptionsScreen.setOnPreferenceClickListener(whiteHackClick);

    final Preference autoRetry = findPreference(Preferences.AUTO_RETRY_FAILED);
    autoRetry.setOnPreferenceChangeListener(mAutoRetryListener);

    final Preference clearPreviewCache = findPreference(Pref.CLEAR_PREVIEW_CACHE);
    clearPreviewCache.setOnPreferenceClickListener(mClearPreviewCacheListener);

    final Preference clearThumbCache = findPreference(Pref.CLEAR_THUMB_CACHE);
    clearThumbCache.setOnPreferenceClickListener(mClearThumbCacheListener);

    final Preference removeDevice = findPreference(Pref.REMOVE_DEVICE);
    removeDevice.setOnPreferenceClickListener(mRemoveDeviceListener);

    mRetryFailed = findPreference(Pref.RETRY_FAILED);
    mRetryFailed.setOnPreferenceClickListener(mRetryFailedListener);

    mCancelFailed = findPreference(Pref.CANCEL_FAILED);
    mCancelFailed.setOnPreferenceClickListener(mCancelFailedListener);

    // Manage category.

    final Preference manageAccount = findPreference(Pref.MANAGE_ACCOUNT);
    manageAccount.setOnPreferenceClickListener(mLinkListener);

    final Preference supportOptions = findPreference(Pref.SUPPORT_OPTIONS);
    supportOptions.setOnPreferenceClickListener(mLinkListener);

    final Preference feedback = findPreference(Pref.FEEDBACK);
    feedback.setOnPreferenceClickListener(mFeedbackListener);

    final PreferenceScreen reportScreen = (PreferenceScreen) findPreference(Pref.REPORT_PROBLEM);
    reportScreen.setOnPreferenceClickListener(whiteHackClick);

    mCollectLogs = (CheckBoxPreference) findPreference(Pref.COLLECT_LOGS);
    mCollectLogs.setOnPreferenceClickListener(mCollectLogsListener);

    mReviewLogs = findPreference(Pref.REVIEW_LOGS);
    mReviewLogs.setOnPreferenceClickListener(mReviewLogsListener);

    mSendLogs = findPreference(Pref.SEND_LOGS);
    mSendLogs.setOnPreferenceClickListener(mSendLogsListener);

    final PreferenceScreen about = (PreferenceScreen) findPreference(Pref.ABOUT);
    about.setSummary(UbuntuOneFiles.getVersion());
    about.setOnPreferenceClickListener(whiteHackClick);

    final Preference license = findPreference(Pref.LICENSE);
    license.setOnPreferenceClickListener(mLinkListener);

    final Preference changelog = findPreference(Pref.CHANGELOG);
    changelog.setOnPreferenceClickListener(mChangelogListener);

    final Preference author = findPreference(Pref.AUTHORS);
    author.setOnPreferenceClickListener(mLinkListener);

    final Preference webpage = findPreference(Pref.WEBPAGE);
    webpage.setOnPreferenceClickListener(mLinkListener);

    final Preference greendroid = findPreference(Pref.GREENDROID);
    greendroid.setOnPreferenceClickListener(mLinkListener);

    receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (UpDownService.BROADCAST_UPLOAD_INFO.equals(action)) {
                final String info = intent.getStringExtra(Intent.EXTRA_TEXT);
                if (info != null) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            adjustTransferPreferencesState();
                            Preference p = findPreference(Pref.UPLOAD_PHOTOS_NOW);
                            if (p != null) {
                                p.setSummary(info);
                            }
                        }
                    });
                }
            }
        }
    };
    registerAutoUploadInfoReceiver(receiver);

    Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(AUTOUPLOAD_SCREEN)) {
            openPreference(Pref.MEDIA_UPLOAD);
        } else if (intent.hasExtra(PURCHASE_STORAGE_SCREEN)) {
            openPreference(Pref.PURCHASE_STORAGE);
        } else if (intent.hasExtra(SHOW_RETRY_FAILED)) {
            // Simply shows top screen. Hilight retry failed pref?
        }
    }
}

From source file:net.basilwang.StaticAttachmentActivity.java

 private void reloadData(PreferenceCategory logonPreference,
      PreferenceScreen logonAddPreference,
      PreferenceManager preferenceManager) {
   // 2012-11-23 basilwang refresh tabbar title
   refreshActionBarTitle();/*w  w w . jav  a  2  s  . co m*/

   logonPreference.removeAll();
   logonPreference.addPreference(logonAddPreference);
   int accountId = PreferenceManager.getDefaultSharedPreferences(this)
         .getInt(LOGON_ACCOUNT_ID, 0);
   AccountService service = new AccountService(this);
   List<Account> list = service.getAccounts();
   if (list.size() == 0) {
      logonAddPreference.setEnabled(true);

   } else {
      logonAddPreference.setEnabled(false);
      for (Account account : list) {
         PreferenceScreen preferenceItem = preferenceManager
               .createPreferenceScreen(this);
         // CheckBoxPreference checkBoxPreference = new
         // CheckBoxPreference(this);
         // make sure each key is unique
         preferenceItem.setKey(LOGON_ACCOUNT_PREFERENCES);
         preferenceItem.setTitle(PreferenceUtils.getPreferUserName(this));
         if (accountId == account.getId())
            preferenceItem.setSummary(R.string.already_checked);
         // preferenceItem.setChecked(false);
         // checkBoxPreference.setDisableDependentsState(disableDependentsState)
         // checkBoxPreference.setSelectable(false);
         preferenceItem.setOrder(0);
         preferenceItem.setOnPreferenceClickListener(this);
         logonPreference.addPreference(preferenceItem);
      }

   }

}