When generating a signature in Android Studio, an error is displayed:
Error: should be static (com.example.goshany.myapplicationATimerPDA.MainActivityATimerPDA.ByebyeDialogFragment) [ValidFragment]
on code:
public class ByebyeDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builderout = new AlertDialog.Builder(getActivity()); builderout.setMessage(R.string.exitTimer) .setPositiveButton(R.string.Yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish();} }); builderout.setNegativeButton(R.string.No, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); return builderout.create(); } } If the class is static, the finish() method is underlined in red. This happens when Build type-release . How can I fix it?