Android DialogFragment - top ranked examples from Open Source projects

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

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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show
 
//BEGIN_INCLUDE(show_dialog) 
    void showDialog() { 
        // Create the fragment and show it as a dialog. 
        DialogFragment newFragment = MyDialogFragment.newInstance();
        newFragment.show(getFragmentManager(), "dialog");
    } 
//END_INCLUDE(show_dialog) 
 
//BEGIN_INCLUDE(dialog) 
    public static class MyDialogFragment extends DialogFragment {
        static MyDialogFragment newInstance() { 
            return new MyDialogFragment(); 
        } 
 
        @Override 
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View v = inflater.inflate(R.layout.hello_world, container, false);
            View tv = v.findViewById(R.id.text);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        // Create and show the dialog. 
        dialogFragment.show(ft, fragmentTag);
    } 
 
    public static void showDialog(@Nonnull android.support.v4.app.DialogFragment dialogFragment,
                                  @Nonnull String fragmentTag,
                                  @Nonnull android.support.v4.app.FragmentManager fm) {
        final android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
 
        android.support.v4.app.Fragment prev = fm.findFragmentByTag(fragmentTag);
        if (prev != null) {
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        // Create and show the dialog. 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, isVisible
 
		return true; 
	} 
 
	private void showSetReportDialog() { 
		if (!dialog.isVisible()) {
			dialog.show(getFragmentManager(), "SetReportNoticeDialog");
		} 
	} 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, setArguments
	@Override 
	public void onListItemClick(ListView l, View v, int position, long id) {
		DialogFragment newFragment = new OptionsDialog();
		Bundle args = new Bundle();
		args.putInt("position", position);
		newFragment.setArguments(args);
	    newFragment.show(getFragmentManager(), "optionsDialog");
	} 
 
	@Override 
	public void onDestroy() { 
		super.onDestroy(); 
	} 
	 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setCancelable, show
		showLogin(); 
	} 
 
	private void showLogin() { 
		DialogFragment newFragment = new LoginDialog(context);
		newFragment.show(getFragmentManager(), "login");
		newFragment.setCancelable(false);		
	} 
	 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, setTargetFragment
	 
	public abstract boolean doDialogPositiveClick(); 
	 
	protected static void initFragment(DialogFragment dialog, CharacterTabContentFragment fragment) 
    { 
        dialog.setTargetFragment(fragment, 0);
        dialog.show(fragment.getFragmentManager(), "dialog");
    } 
     
    protected CharacterTabContentFragment getTargetFragmentEx() 
    { 
    	return (CharacterTabContentFragment)getTargetFragment();
    } 
     
    protected GameFolder getGame() 
    { 
    	return getTargetFragmentEx().getGame(); 
    } 
     
    protected GameResourceCharacter getCharacter() 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show, setArguments
		DialogFragment dlg = new ProgressDialogFragment();
		Bundle b = new Bundle();
		if (title != null)
			b.putString("title", title);
		b.putString("message", message);
		dlg.setArguments(b);
		dlg.show(getFragmentManager(), TAG_PROG_DLG);
	} 
	 
	public void dismissProgressDialog() { 
		DialogFragment frag = (DialogFragment)getFragmentManager().findFragmentByTag(TAG_PROG_DLG);
		if (frag != null)
			frag.dismiss();
	} 
	 
	public void processException(Exception e) {
		String msg = "unknown exception";
		if (e != null)
			msg = e.getLocalizedMessage();
		Log.e(TAG, msg);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android DialogFragment Questions & Answers:

Other Android DialogFragment Examples

1:	public void showDatePickerDialog(View v) {
2:	    DialogFragment newFragment = new DatePickerFragment();
3:	    newFragment.show(getSupportFragmentManager(), "datePicker");
4:	}

Read More

1:	public void showTimePickerDialog(View v) {
2:	    DialogFragment newFragment = new TimePickerFragment();
3:	    newFragment.show(getSupportFragmentManager(), "timePicker");
4:	}

Read More

1:	public static class DatePickerFragment extends DialogFragment
2:	                            implements DatePickerDialog.OnDateSetListener {
3:

Read More

See Code Examples for Android DialogFragment Methods: