List of usage examples for android.preference PreferenceCategory setSummary
public void setSummary(CharSequence summary)
From source file:com.aokp.romcontrol.github.tasks.DisplayProjectsListTask.java
private void addPropertiesToPreference(PreferenceCategory mProject, JSONObject projectsObject) { try {/*from w w w .jav a2 s . c o m*/ // extract info about each project final String projectName = projectsObject.getString("name"); String projectDescription = projectsObject.getString("description"); int githubProjectId = projectsObject.getInt("id"); // apply info to our preference screen mProject.setKey(projectName); if (projectDescription.contains("") || projectDescription == null) { mProject.setTitle(projectName); mProject.setSummary(projectDescription); } else { mProject.setTitle(projectDescription); mProject.setSummary(projectName); } mProject.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference p) { FragmentTransaction transaction = mFragmentManager.beginTransaction(); CommitsFragment commitFragment = new CommitsFragment(mAlertDialog, projectName); transaction.addToBackStack(null); transaction.replace(mId, commitFragment, projectName); transaction.commit(); return true; } }); } catch (JSONException badJsonRequest) { Log.e(TAG, "failed to parse required info about project", badJsonRequest); } }