Code example for DialogFragment

Methods: show

0
 
//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);