Tuesday, 27 August 2013

Passing Data between intents I have one error

Passing Data between intents I have one error

That's my code...
Intent NewsIntent = new Intent(this, NewsListActivity.class);
NewsIntent.putExtra("element_group", (Integer)group);
NewsIntent.putExtra("element_index", (Integer)index);
startActivity(NewsIntent);
and in the NewsListFragment I get them in this way
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setTitle(R.string.app_name);
reader = GoogleReaderManager.get(getActivity());
int element_group=getArguments().getInt("element_group");
int element_index=getArguments().getInt("element_index");
I think that the error is in the way I get the data because if I manually
set them (example element_group=1 and element_index=4) everything is ok.
The error is infact javaNullPointerException.

No comments:

Post a Comment