DialogFragment dismiss - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for DialogFragment dismiss method.

This code example shows how to use the following methods:dismiss, getTargetFragment, isResumed
		// We'll get around this by setting mTask to null in that case - onResume will then call dismiss() 
		 
		// Setting mTask to null also ensures that we don't declare the task cancelled on dismiss 
		mTask = null;
				 
		if (isResumed()) {
			dismiss();
		} 
 
		// Tell the fragment that we are done. 
		Fragment target = getTargetFragment();
		if (target != null) {
			if (!(target instanceof Callbacks)) {
				throw new IllegalStateException("DetectorTaskFragment target must implement its callbacks");
			} 
			 
			((Callbacks)target).onTaskFinished(results);
		} 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:dismiss
        } 
    } 
 
    private void dismissDialog() { 
        if (mDialog != null) {
            mDialog.dismiss();
            mDialog = null;
        } 
    } 
 
    private void doPositiveClick() { 
        Settings.Global.putInt(getContentResolver(),
                Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 1); 
        setResult(RESULT_OK);
        finish();
    } 
 
    private void doNegativeClick() { 
        setResult(RESULT_CANCELED);
        finish();
6
CodeRank
This code example shows how to use the following methods:dismiss, isVisible
 
	@Override 
	protected void onCancelled() { 
		final FragmentManager fm = activity.getFragmentManager();
		final DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG);
		if (fragment != null && fragment.isVisible()) {
			fragment.dismiss();
		} 
		super.onCancelled(); 
	} 
 
	@Override 
	protected void onPostExecute(final File result) {
		final FragmentManager fm = activity.getFragmentManager();
		final DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG);
		if (fragment != null) {
			fragment.dismiss();
		} 
		super.onPostExecute(result);
		if (result != null && result.exists()) {
7
CodeRank
This code example shows how to use the following methods:dismiss, getActivity, getArguments
      .setAdapter(mAdapter,this)
      .create();
  } 
  @Override 
  public void onClick(DialogInterface dialog, int which) {
    SelectFromCursorDialogListener activity = (SelectFromCursorDialogListener) getActivity();
    Bundle args = getArguments();
    args.putLong("result", ((AlertDialog) dialog).getListView().getItemIdAtPosition(which));
    activity.onItemSelected(args);
    dismiss();
  } 
  public void setCursor(Cursor c) {
    mAdapter.swapCursor(c);
  } 
} 
6
CodeRank
This code example shows how to use the following methods:dismiss
		} 
	} 
 
	@Click(R.id.dialog_no) 
	void cancel() { 
		dismiss();
	} 
 
	@Click(R.id.dialog_yes) 
	void confirm() { 
		final SharedPreferences settings = PreferenceManager
				.getDefaultSharedPreferences(getActivity());
		final String currentPassword = settings.getString(PasswordPrefs.KEY_PASSWORD,
				""); 
		final String enteredPassword = passwordField.getText().toString();
		final String verifiedPassword = passwordVerificationField.getText()
				.toString();
 
		if (currentPassword.isEmpty()) {
			setPassword(enteredPassword, verifiedPassword);
6
CodeRank
This code example shows how to use the following methods:dismiss, onCreate, getActivity, getArguments
		return dialog;
	} 
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mCorrect = getArguments().getBoolean(CORRECT);
		mWord = (WordWithTranslation) getArguments().getSerializable(WORD);
		if (getActivity() instanceof OnDismissListener) {
			mActivity = (OnDismissListener) getActivity();
		} else { 
			Log.d("tag", getActivity().getClass()
					+ " must implement OnDismissListener"); 
			dismiss();
		} 
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
5
CodeRank
This code example shows how to use the following methods:dismiss, getActivity
 
		String uri = items.get(key);
		if (uri == null)
			return; 
 
		dismiss();
 
		MainActivity activity = ((MainActivity) getActivity());
		activity.loadUri(Uri.parse(uri));
	} 
 
	@Override 
	public void onLoaderReset(Loader<Map<String, String>> arg0) {
		items = null;
	} 
} 
6
CodeRank
This code example shows how to use the following methods:dismiss, getActivity, isValidEmail, isValidPhone
	public void onClick(View arg0) {
		// TODO Auto-generated method stub 
		String email = emailEditText.getText().toString();
		String phoneNumber = phoneNumberEditText.getText().toString();
		 
		if(!isValidEmail(email)){
			emailEditText.setError("Invalid Email");
			return; 
		} 
		 
		if(!isValidPhone(phoneNumber)){
			phoneNumberEditText.setError("Invalid Phone Number");
			return; 
		} 
		 
		MainActivity activity = (MainActivity) getActivity();
		 
		UserData userData = new UserData();
		userData.setEmail(email);
		userData.setPhonenumber(phoneNumber);

6
CodeRank
This code example shows how to use the following methods:dismiss, getFragmentManager, isAdded
  private BroadcastReceiver c;
  private p d;
 
  private void a() 
  { 
    if ((this.b != null) && (isAdded()))
      this.b.hide();
    this.a = false;
    this.b = null;
  } 
 
  private void a(Context paramContext)
  { 
    a(); 
    if (isAdded())
    { 
      this.b = new ProgressDialog(paramContext);
      this.b.setMessage(getString(z.U));
      this.b.setCancelable(false);
      this.b.show();

5
CodeRank
This code example shows how to use the following methods:dismiss
        } 
    } 
 
    private void dismissDialog() { 
        if (mDialog != null) {
            mDialog.dismiss();
            mDialog = null;
        } 
    } 
 
    private void doPositiveClick() { 
        Settings.Global.putInt(getContentResolver(),
                Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 1); 
        setResult(RESULT_OK);
        finish();
    } 
 
    private void doNegativeClick() { 
        setResult(RESULT_CANCELED);
        finish();
5
CodeRank
dismiss Method Overview
Dismiss the fragment and its dialog.
See Code Examples for other Android DialogFragment Methods: