Code example for DialogFragment

1
import android.os.Bundle; 
import android.support.v4.app.DialogFragment; 
import android.view.View; 
import android.widget.EditText; 
 
public class AddFeedDialogFragment extends DialogFragment {
  @Override 
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    final View form=getActivity()
                      .getLayoutInflater()
                      .inflate(R.layout.add_feed, null);
   
    return(new AlertDialog.Builder(getActivity())
            .setTitle(R.string.add_feed)
            .setView(form)
            .setPositiveButton(R.string.add, 
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                  processAdd(form);
                } 
Experience pair programming with AI  Get Codota for Java