if this has already been asked and answered, sorry, but havent found it. Im new at android.
At the base of my application I have a class that extends Activity. It contains three buttons whereof two lead to new classes that also extend activity. In these cases the physical back button leads back to the three buttons, which is what I want. In the third case the button leads to a class that extends FragmentActivity. Here pressing the physical backbutton exits the program instead. The class seems to need to extend FragmentActivity instead of activity, since it has an array of buttons, which display Dialogs when pressed, and these seem to need to be contained in a class that extends FragmentActivity!
Do I need to override the back button or is there something obvious Im missing?
This is the call to show the Dialog:
public void showInfoVeryLight(View view){
VeryLightDialogFragment vldf = new VeryLightDialogFragment();
vldf.show(getSupportFragmentManager(),"very light");
}
This is VeryLightDialogFragment class:
public class VeryLightDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.dialog_message_veryLight)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
return builder.create();
}
}
Thanks for any help!:)