Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Custom Dialogs in android using DialogFragment

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 839
    Comment on it


    Custom Dialogs in android using DialogFragment:

    DialogFragment is the fragment that shows dialog window on top of your activity.

    We have to override DialogFragment class and implement onCreateView(LayoutInflater, ViewGroup, Bundle) to use the content of the dialog.

    I am showing listview on this dialog window.

    public class DFragment extends DialogFragment {
            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                    Bundle savedInstanceState) {
                View rootView = inflater.inflate(R.layout.custom_dialog_flag, container,
                        false);
                FlagAdapter flagAdapter = new FlagAdapter(RegisterationMedVisitDoctor.this, flagList);
                listViewCountryFlags =(ListView) rootView.findViewById(R.id.list_view_country_flags);
                listViewCountryFlags.setAdapter(flagAdapter);
                getDialog().setTitle("Select Country"); 
                listViewCountryFlags.setAdapter(flagAdapter);

    // Do something else return rootView; } }



    and call this class from specified position


    DFragment dFragment = new DFragment();
    dFragment.show(getFragmentManager(), "Alert Dialog");

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: