I'm working with fragments and encounter with a following problem :
- While passing data from fragments i used bundle to pass integer values and sending them through intent.
- I'm calling them by using intent .
- But while i'm printing then i'm getting only Null values.
From fragment
:
Bundle bundle = new Bundle();
bundle.putInt("myData", x);
Intent in=new Intent(getActivity(),B.class);
in.putExtra("xy", bundle);
startActivity(in);
In Activity
:
Intent in=getIntent();
Bundle bundle = getIntent().getExtras();
int value = bundle.getInt("myData");
Log.v("in mainactivity",""+value);
Here it getting Null values. I hope u understand the problem.