Code example for DialogFragment

Methods: show

    void showDialog() { 
        // Create the fragment and show it as a dialog. 
        DialogFragment newFragment = MyDialogFragment.newInstance();, "dialog");
    public static class MyDialogFragment extends DialogFragment {
        static MyDialogFragment newInstance() { 
            return new MyDialogFragment(); 
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View v = inflater.inflate(R.layout.hello_world, container, false);
            View tv = v.findViewById(;
Connect your IDE to all the code out there  Get Codota for Java