that I can use so that when I click on the back button on Android it takes me to a fragment that I choose. I mean, I'm on a screen, and clicking on the back, takes me to another one but not the previous one, but another.
Code
public class BP_ColesBruselas extends Fragment {
public BP_ColesBruselas() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view;
view = inflater.inflate(R.layout.fragment_bp__coles_bruselas, container, false);
return view ;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == event.KEYCODE_BACK) {
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.content_main,new Bajar_Peso()).commit();
}
return super.onKeyDown(keyCode, event);
}
}