I'm trying to pass an int value from one activity to Fragment
, but the value is not passed and assigned a default
value.
The class from which to send the int value
int level=3;
Intent myIntent = new Intent(this, ExampleBottomSheetDialog.class);
myIntent.putExtra("level", level);
The Fragment that should get an int value
int level = getActivity().getIntent().getIntExtra("level", 0);
As I understand it, there should be a completely different code, as we pass the value to the fragment. How to convey the value int from activity to the fragment?