Skip to content Skip to sidebar Skip to footer

Show Progressdialog In Fragment Class

I am trying to show a ProgressDialog within a Fragment class. The following code just works within an Activity class but not for Fragment. Can somebody please help me on this, why

Solution 1:

Try this in Fragment

nDialog = new ProgressDialog(getActivity()); 

Solution 2:

ProgressDialog take Context input so use getActivity() in object creation.

ProgressDialogdialog= ProgressDialog.show(getActivity(), "Loading...", "Please wait...", true);

Post a Comment for "Show Progressdialog In Fragment Class"