How to use newFragment.show()?

Asked

Viewed 32 times

1

I’m having trouble displaying a calendar after clicking on a button. Does not recognize the 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;

1 answer

0

I got!

The correct code:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.