Code example for DialogFragment

0
import android.os.Bundle; 
import android.support.v4.app.DialogFragment; 
import android.util.Log; 
import android.widget.Toast; 
 
public class SampleDialogFragment extends DialogFragment {
  @Override 
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dlg=new ProgressDialog(getActivity());
 
    dlg.setMessage(getActivity().getString(R.string.dlg_title));
    dlg.setIndeterminate(true);
    dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
 
    return(dlg);
  } 
 
  @Override 
  public void onDismiss(DialogInterface unused) {
    super.onDismiss(unused);
Connect your IDE to all the code out there  Get Codota for Java