List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display a grid of all installed apps + virtual apps. Allow user to launch * apps./*w w w. ja v a 2s .com*/ * * @param context * @param applications */ public static void displayAllApps(final Launcher context, final ArrayList<ApplicationInfo> applications) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.apps_grid); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); gridView.setAdapter(new AllItemAdapter(context, getApplications(context, applications, false))); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); itemInfo.invoke(context); context.showCover(false); dialog.dismiss(); if (itemInfo instanceof ApplicationInfo) { ApplicationInfo applicationInfo = (ApplicationInfo) itemInfo; RecentAppsTable.persistRecentApp(context, applicationInfo); } } }); gridView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> gridView, View view, int pos, long arg3) { ItemInfo itemInfo = (ItemInfo) gridView.getAdapter().getItem(pos); if (itemInfo instanceof ApplicationInfo) { Uri packageURI = Uri.parse("package:" + itemInfo.getIntent().getComponent().getPackageName()); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.UNINSTALL_APP); } return false; } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ALL_APPS); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display the list of browser bookmarks. Allow user to load bookmarked web * site.//ww w .j a va2 s . co m * * @param context */ public static void displayBookmarks(final Launcher context) { final ArrayList<BookmarkInfo> bookmarks = loadBookmarks(context); if (bookmarks.size() > 0) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bookmarks_list); ListView listView = (ListView) dialog.findViewById(R.id.list); Collections.sort(bookmarks, new Comparator<BookmarkInfo>() { @Override public int compare(BookmarkInfo lhs, BookmarkInfo rhs) { return lhs.getTitle().toLowerCase().compareTo(rhs.getTitle().toLowerCase()); } }); listView.setAdapter(new BookmarkAdapter(context, bookmarks)); listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { BookmarkInfo bookmark = (BookmarkInfo) parent.getAdapter().getItem(position); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(bookmark.getUrl())); context.startActivity(browserIntent); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.INVOKE_BOOKMARK); } }); listView.setDrawingCacheEnabled(true); listView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_BOOKMARKS); } else { displayAlert(context, context.getString(R.string.dialog_no_browser_bookmarks)); } }
From source file:com.mimp.fragment.institucion.PlanTrabajoPage.java
public void btnAgregar() { final Dialog dialog = new Dialog(this.getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); //dialog.setCancelable(false); dialog.setContentView(R.layout.dialog_plan_trabajo); TextView lblResponsable = (TextView) dialog.findViewById(R.id.lblResponsable); lblResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblResponsable.getTextSize() + SizeText); TextView lblDResponsable = (TextView) dialog.findViewById(R.id.lblDResponsable); lblDResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblDResponsable.getTextSize() + SizeText); TextView lblObejtivo = (TextView) dialog.findViewById(R.id.lblObejtivo); lblObejtivo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblObejtivo.getTextSize() + SizeText); TextView lblMeta = (TextView) dialog.findViewById(R.id.lblMeta); lblMeta.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblMeta.getTextSize() + SizeText); TextView lblActividad = (TextView) dialog.findViewById(R.id.lblActividad); lblActividad.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblActividad.getTextSize() + SizeText); TextView lblCronograma = (TextView) dialog.findViewById(R.id.lblCronograma); lblCronograma.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblCronograma.getTextSize() + SizeText); final EditText txtObejtivo = (EditText) dialog.findViewById(R.id.txtObejtivo); txtObejtivo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtObejtivo.getTextSize() + SizeText); txtObejtivo.setText(""); final EditText txtActividad = (EditText) dialog.findViewById(R.id.txtActividad); txtActividad.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtActividad.getTextSize() + SizeText); txtActividad.setText(""); final EditText txtCronograma = (EditText) dialog.findViewById(R.id.txtCronograma); txtCronograma.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtCronograma.getTextSize() + SizeText); txtCronograma.setText(""); final EditText txtMeta = (EditText) dialog.findViewById(R.id.txtMeta); txtMeta.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtMeta.getTextSize() + SizeText); txtMeta.setText(""); final EditText txtResponsable = (EditText) dialog.findViewById(R.id.txtResponsable); txtResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtResponsable.getTextSize() + SizeText); txtResponsable.setText(""); Button btnAgregar = (Button) dialog.findViewById(R.id.btnAgregar); btnAgregar.setOnClickListener(new View.OnClickListener() { @Override/* www .ja va2 s . c o m*/ public void onClick(View v) { clsPlanTrabajo entidad = new clsPlanTrabajo(); entidad.setActividad(txtActividad.getText().toString()); entidad.setCronograma(txtCronograma.getText().toString()); entidad.setMeta(txtMeta.getText().toString()); entidad.setObejtivo(txtObejtivo.getText().toString()); entidad.setResponsable(txtResponsable.getText().toString()); list.add(entidad); getListaPlanTrabajo(); dialog.dismiss(); } }); dialog.show(); }
From source file:de.hero.vertretungsplan.PrefsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); ListPreference listPref = (ListPreference) findPreference("prefs_benachrichtigungsintervall"); listPref.setSummary(/*from w ww. ja v a 2 s . c o m*/ getSummaryInterval(mySharedPreferences.getString("prefs_benachrichtigungsintervall", "1"))); listPref.setOnPreferenceChangeListener(new ListPreference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { preference.setSummary(getSummaryInterval(newValue.toString())); MainActivity.setNewAlarm(getBaseContext(), true, newValue.toString()); return true; } }); Preference klasse = findPreference("prefs_klasse"); klasse.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { showDialog(R.string.dialog_klasse); return true; } }); CheckBoxPreference ckBxPref = (CheckBoxPreference) findPreference("prefs_benachrichtigungen"); ckBxPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_benachrichtigungen")) { MainActivity.setNewAlarm(getBaseContext(), !((CheckBoxPreference) preference).isChecked(), mySharedPreferences); } return true; } }); CheckBoxPreference ckBxPrefAppUpdate = (CheckBoxPreference) findPreference("prefs_check_for_app_updates"); ckBxPrefAppUpdate.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_check_for_app_updates")) { Intent i = new Intent(getBaseContext(), CheckForAppUpdate.class); i.putExtra("setTimer", !((CheckBoxPreference) preference).isChecked()); if (!((CheckBoxPreference) preference).isChecked()) { i.putExtra("checkNow", true); } getBaseContext().startService(i); } return true; } }); Preference ueber = findPreference("ueber"); ueber.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { Dialog ueberDialog = new Dialog(PrefsActivity.this); ueberDialog.setContentView(R.layout.ueber_dialog_layout); ueberDialog.setTitle(getString(R.string.ueber)); ueberDialog.setCancelable(true); ueberDialog.setCanceledOnTouchOutside(true); TextView dialogText = (TextView) ueberDialog.findViewById(R.id.text_in_dialog); dialogText.setTextColor(Color.BLACK); dialogText.setAutoLinkMask(Linkify.ALL); dialogText.setText(String.format(getString(R.string.ueberTextFormated), getString(R.string.version_nr), getString(R.string.emailAdresseEntwickler), getString(R.string.webAdresseAppDownload), getString(R.string.GNU_GPLwebadresse))); ueberDialog.show(); return true; } }); CheckBoxPreference ckBxPrefDebugging = (CheckBoxPreference) findPreference("prefs_debug"); ckBxPrefDebugging.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("prefs_debug")) { Log.d("PrefsActivity", "new"); if (!((CheckBoxPreference) preference).isChecked()) { AlertDialog.Builder builder = new AlertDialog.Builder(preference.getContext()); builder.setMessage(getString(R.string.debugText)).setTitle(getString(R.string.debugTitel)); AlertDialog dialog = builder.create(); dialog.show(); } } return true; } }); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to allow user to add an app to a row. The user can add the * app to an existing row or a new row./*ww w.j a v a 2 s . c o m*/ * * @param context * @param applications */ public static void displayAddApps(final Launcher context, final ArrayList<ApplicationInfo> applications) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.add_apps_grid); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); } }); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); gridView.setAdapter(new AllItemAdapter(context, getApplications(context, applications, true))); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if the new row radio button is selected, the user must enter // a name for the new row String name = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && name.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); boolean currentRow = !newRadioButton.isChecked(); context.addItem(itemInfo, currentRow ? null : name); context.showCover(false); dialog.dismiss(); if (currentRow) { Analytics.logEvent(Analytics.DIALOG_ADD_APP); } else { Analytics.logEvent(Analytics.ADD_APP_WITH_ROW); } } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_APP); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to the user for the Spotlight web apps: * https://www.google.com/tv/spotlight-gallery.html Allow the user to add a * web app to an existing row or a new row. * //from w ww. j ava2 s . c o m * @param context */ public static void displayAddSpotlight(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.add_apps_grid); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); } }); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); final ArrayList<SpotlightInfo> spotlights = SpotlightTable.getAllSpotlights(context); gridView.setAdapter(new AllSpotlightAdapter(context, spotlights)); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if the new row radio button is selected, the user must enter // a name for the new row String name = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && name.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); boolean currentRow = !newRadioButton.isChecked(); context.addItem(itemInfo, currentRow ? null : name); context.showCover(false); dialog.dismiss(); if (currentRow) { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP); } else { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP_WITH_ROW); } } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_SPOTLIGHT_WEB_APP); }
From source file:com.osama.cryptofm.filemanager.ui.FilemanagerTabs.java
@ActionHandler(layoutResource = R.id.fab_add_folder) public void onAddFloatingClicked(View v) { UiUtils.actionMode = this.actionMode; if (mCurrentFragment == null) { Log.d(TAG, "onAddFloatingClicked: fragment is null "); mCurrentFragment = mFragmentOnes[0]; }/*from w ww . ja v a2 s .c o m*/ FileUtils.CURRENT_PATH = mCurrentFragment.getmCurrentPath(); String uri = null; Log.d(TAG, "onAddFloatingClicked: current path is: " + FileUtils.CURRENT_PATH); if (isEmptyFolder) { removeNoFilesFragment(); } final Dialog dialog = UiUtils.createDialog(this, "Create Folder", "create"); final EditText folderEditText = (EditText) dialog.findViewById(R.id.foldername_edittext); Button okayButton = (Button) dialog.findViewById(R.id.create_file_button); okayButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String folderName = folderEditText.getText().toString(); if (folderName.length() < 1) { folderEditText.setError("Give me the folder name"); } else { if (FileUtils.isSdCardPath("")) { Log.d(TAG, "onClick: Yes nigga creating folder via document"); FileDocumentUtils.createFolder(FileUtils.CURRENT_PATH, folderName); dialog.dismiss(); UiUtils.reloadData(FilemanagerTabs.this, mCurrentFragment.getmFileAdapter()); } else if (!FileUtils.createFolder(folderName)) { Toast.makeText(FilemanagerTabs.this, "Cannot create folder make sure current path is writable", Toast.LENGTH_SHORT) .show(); } else { dialog.dismiss(); UiUtils.reloadData(FilemanagerTabs.this, mCurrentFragment.getmFileAdapter()); } } } }); }
From source file:com.procleus.brime.ui.LabelsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment ((MainActivity) getActivity()).setActionBarTitle("Labels"); ((MainActivity) getActivity()).showFloatingActionButton(true); final View v = inflater.inflate(R.layout.labels_gragment, container, false); final NotesDbHelperOld tn = new NotesDbHelperOld(getActivity()); labelsRetrieved = new ArrayList<String>(); labelsRetrieved = tn.retrieveLabel(); listView = (ListView) v.findViewById(R.id.listLabel); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, labelsRetrieved); listView.setAdapter(arrayAdapter);/*from ww w. j a v a2s. c o m*/ ImageButton addLabelBtn = (ImageButton) v.findViewById(R.id.addLabelBtn); addLabelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { addLabelFunc(v, tn); } }); /*/WORK OF LONG ITEM CLICK LISTENER*/ listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(final AdapterView<?> parent, View view, final int position, long id) { final Dialog dialog = new Dialog(getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setCancelable(false); dialog.setContentView(R.layout.dialog_label); dialog.show(); final Button negative = (Button) dialog.findViewById(R.id.btn_no_label); final Button positive = (Button) dialog.findViewById(R.id.btn_yes_label); negative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); positive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("brinjal", "Yes"); tn.deleteTextNote(String.valueOf(parent.getItemAtPosition(position))); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, labelsRetrieved); listView.setAdapter(arrayAdapter); dialog.dismiss(); } }); return true; } }); return v; }
From source file:com.procleus.brime.ui.LabelsFragment.java
@Override public void onResume() { super.onResume(); NotesDbHelperOld tn = new NotesDbHelperOld(getContext()); labelsRetrieved = tn.retrieveLabel(); listView = (ListView) getView().findViewById(R.id.listLabel); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, labelsRetrieved); listView.setAdapter(arrayAdapter);// www .j a v a 2 s . c o m listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(final AdapterView<?> parent, View view, final int position, long id) { final Dialog dialog = new Dialog(getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setCancelable(false); dialog.setContentView(R.layout.dialog_label); dialog.show(); final Button negative = (Button) dialog.findViewById(R.id.btn_no_label); final Button positive = (Button) dialog.findViewById(R.id.btn_yes_label); /*/This is Database Spinner Retreival*/ /* Spinner getting Data from dataBase*/ negative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); positive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("brinjalResume", "Yes"); NotesDbHelperOld tn = new NotesDbHelperOld(getActivity()); tn.deleteTextNote(String.valueOf(parent.getItemAtPosition(position))); labelsRetrieved = tn.retrieveLabel(); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, labelsRetrieved); listView.setAdapter(arrayAdapter); dialog.dismiss(); } }); return true; } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(getActivity(), "Inside in label" + ":" + String.valueOf(parent.getItemAtPosition(position)), Toast.LENGTH_SHORT).show(); Intent i = new Intent(getActivity(), LabelOpenActivity.class); i.putExtra("label", String.valueOf(parent.getItemAtPosition(position))); startActivity(i); } }); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Prompt the user to rate the app.// w w w .ja v a 2 s . c o m * * @param context */ public static void displayRating(final Launcher context) { SharedPreferences prefs = context.getSharedPreferences(Launcher.PREFERENCES_NAME, Activity.MODE_PRIVATE); if (prefs.getBoolean(DONT_SHOW_RATING_AGAIN, false)) { return; } final SharedPreferences.Editor editor = prefs.edit(); // Get date of first launch Long date_firstLaunch = prefs.getLong(DATE_FIRST_LAUNCHED, 0); if (date_firstLaunch == 0) { date_firstLaunch = System.currentTimeMillis(); editor.putLong(DATE_FIRST_LAUNCHED, date_firstLaunch); } // Wait at least n days before opening if (System.currentTimeMillis() >= date_firstLaunch + (DAYS_UNTIL_PROMPT * 24 * 60 * 60 * 1000)) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirmation); TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText); confirmationTextView.setText(context.getString(R.string.rating_message)); Button buttonYes = (Button) dialog.findViewById(R.id.button1); buttonYes.setText(context.getString(R.string.dialog_yes)); buttonYes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.entertailion.android.launcher")); context.startActivity(intent); if (editor != null) { editor.putBoolean(DONT_SHOW_RATING_AGAIN, true); editor.commit(); } Analytics.logEvent(Analytics.RATING_YES); context.showCover(false); dialog.dismiss(); } }); Button buttonNo = (Button) dialog.findViewById(R.id.button2); buttonNo.setText(context.getString(R.string.dialog_no)); buttonNo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (editor != null) { editor.putBoolean(DONT_SHOW_RATING_AGAIN, true); editor.commit(); } Analytics.logEvent(Analytics.RATING_NO); context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); } editor.commit(); }