dismiss Dialog Fragment - Android User Interface

Android examples for User Interface:Fragment

Description

dismiss Dialog Fragment

Demo Code


import android.os.Handler;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;

public class Main{
    public static final void dismissDialogFragment(
            final FragmentManager manager, final String tag) {
        Handler handler = HandlerUtils.getHandler();
        handler.post(new Runnable() {
            @Override/* ww  w.j  a va  2s. com*/
            public void run() {
                DialogFragment dialogFragment = (DialogFragment) manager
                        .findFragmentByTag(tag);
                if (dialogFragment != null) {
                    dialogFragment.dismiss();
                }
            }
        });
    }
}

Related Tutorials