DialogFragment setCancelable - 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 setCancelable method.

This code example shows how to use the following methods:setCancelable, getActivity, getArguments
This code example shows how to use the following methods:getDialog, setCancelable, show
        assertTrue(shadowOf(dialog).isCancelable());
    } 
 
    @Test 
    public void shouldSetNotCancelableOnDialogBeforeShow() throws Exception { 
        DialogFragment dialogFragment = new DialogFragment();
        dialogFragment.setCancelable(false);
        dialogFragment.show(fragmentManager, "TAG");
 
        Dialog dialog = dialogFragment.getDialog();
 
        assertFalse(shadowOf(dialog).isCancelable());
    } 
 
    @Test 
    public void shouldSetNotCancelableOnDialogAfterShow() throws Exception { 
        DialogFragment dialogFragment = new DialogFragment();
        dialogFragment.show(fragmentManager, "TAG");
        dialogFragment.setCancelable(false);
 
7
CodeRank
This code example shows how to use the following methods:onCreate, setCancelable, setRetainInstance
	 
	 
	@Override 
	public void onCreate(Bundle savedInstanceState)
	{ 
		super.onCreate(savedInstanceState);
		 
		setCancelable(false);
		setRetainInstance(true);
	} 
	 
	 
	@Override 
	public void onDestroyView() 
	{ 
		// http://code.google.com/p/android/issues/detail?id=17423 
		if(getDialog() != null && getRetainInstance()) getDialog().setDismissMessage(null);
		super.onDestroyView(); 
	} 
	 
7
CodeRank
This code example shows how to use the following methods:setCancelable
 
public class ProgressDialog extends DialogFragment {
 
    public static ProgressDialog newInstance() { 
        ProgressDialog f = new ProgressDialog();
        f.setCancelable(false);
        return f;
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        setStyle(STYLE_NO_TITLE, 0);
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.progress_dialog, container, false);
        return v;
7
CodeRank
This code example shows how to use the following methods:setCancelable, show
	} 
 
	@Override 
	protected void onPreExecute() { 
		final DialogFragment fragment = new ProgressDialogFragment();
		fragment.setCancelable(false);
		fragment.show(activity.getFragmentManager(), PROGRESS_FRAGMENT_TAG);
		super.onPreExecute(); 
	} 
 
	public static File saveImage(final Context context, final File image_file) {
		if (context == null && image_file == null) return null;
		try { 
			final String name = image_file.getName();
			if (isEmpty(name)) return null;
			final String mime_type = getImageMimeType(image_file);
			final MimeTypeMap map = MimeTypeMap.getSingleton();
			final String extension = map.getExtensionFromMimeType(mime_type);
			if (extension == null) return null;
			final String name_to_save = name.indexOf(".") != -1 ? name : name + "." + extension;
6
CodeRank
This code example shows how to use the following methods:setCancelable
package com.google.android.finsky.billing.creditcard; 
 
import android.app.Dialog; 
import android.app.ProgressDialog; 
import android.os.Bundle; 
import android.support.v4.app.DialogFragment; 
import android.support.v4.app.FragmentActivity; 
 
public class SavingDialog extends DialogFragment {
 
   public SavingDialog() { 
      this.setCancelable((boolean)0);
   } 
 
   public Dialog onCreateDialog(Bundle var1) {
      FragmentActivity var2 = this.getActivity();
      ProgressDialog var3 = new ProgressDialog(var2);
      var3.setProgressStyle(0);
      CharSequence var4 = this.getActivity().getText(2131230799);
      var3.setMessage(var4);

6
CodeRank
This code example shows how to use the following methods:setCancelable, getActivity, getArguments, getString
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
 
        int resTitle = getArguments().getInt("title");
        int closeLabel = getArguments().getInt("closeLabel");
        String changeLog = getArguments().getString("changeLog");
 
        String title = getString(resTitle, VersionUtils.getVersionName(this.getActivity()));
 
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(title);
        this.setCancelable(true);
 
        final WebView webView = new WebView(this.getActivity());
        webView.loadDataWithBaseURL(null, changeLog, "text/html", "utf-8", null);
        builder.setView(webView);
        builder.setNeutralButton(closeLabel,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
5
CodeRank
This code example shows how to use the following methods:setCancelable, getActivity, getArguments, getResources
    return localProgressDialogFragment;
  } 
 
  public Dialog onCreateDialog(Bundle paramBundle)
  { 
    setCancelable(false);
    ProgressDialog localProgressDialog = new ProgressDialog(getActivity());
    localProgressDialog.setProgressStyle(0);
    int i = getArguments().getInt("message_id", 2131165432);
    localProgressDialog.setMessage(getResources().getString(i));
    localProgressDialog.setCancelable(false);
    localProgressDialog.setIndeterminate(true);
    return localProgressDialog;
  } 
} 
 
/* Location:           D:\dex2jar-0.0.9.10\classes-dex2jar.jar 
 * Qualified Name:     com.google.android.finsky.billing.ProgressDialogFragment 
 * JD-Core Version:    0.6.2 
 */ 
6
CodeRank
This code example shows how to use the following methods:setCancelable, getActivity, getArguments
        return dialogFragment;
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Bundle args = getArguments();
        Builder b = new Builder(getActivity());
        b.setTitle(args.getString(BUNDLE_TITLE));
        b.setMessage(args.getString(BUNDLE_MESSAGE));
        b.setIcon(android.R.drawable.ic_dialog_alert);
        setCancelable(true);
        b.setNeutralButton(getActivity().getString(android.R.string.ok), mOnClickListener);
        return b.create();
    } 
 
    @Override 
    public void onCancel(DialogInterface dialog) {
        if (mOnCancelListener != null) {
            mOnCancelListener.onCancel();
        } 
5
CodeRank
This code example shows how to use the following methods:setCancelable, setArguments
    } 
 
    public static MagicWordDialog newInstance() { 
        MagicWordDialog frag = new MagicWordDialog();
        Bundle args = new Bundle();
        frag.setArguments(args);
        frag.setCancelable(false);
        return frag;
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        LayoutInflater factory = LayoutInflater.from(getActivity());
        final View magicWordView = factory.inflate(R.layout.magic_word_dialog, null);
        magicWordText = (EditText) magicWordView.findViewById(R.id.password_edit);
        magicWordText.setOnEditorActionListener(this);
        return new AlertDialog.Builder(getActivity())
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setTitle(R.string.magic_word_dialog_title)
            .setView(magicWordView)
5
CodeRank
setCancelable Method Overview
Control whether the shown Dialog is cancelable.
See Code Examples for other Android DialogFragment Methods: