How to use newFragment.show ()?

1

I'm having trouble displaying a calendar after clicking a button . Does not recognize newFragment.show();

public void secionarData(View view) {
    DialogFragment dialogo = new DatePickerFragment();
    newFragment.show(this.getFragmentManager(),"Date Picker");
}

I have already imported the following packages and the problem remains:

import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import java.util.Calendar;
    
asked by anonymous 20.06.2018 / 20:04

1 answer

0

I did it!

The correct code:

 public void secionarData(View view) {
        DialogFragment dialogo = new DatePickerFragment();
        dialogo.show(this.getFragmentManager(), "Date Picker");
    }
    
21.06.2018 / 14:14