Intent.getInt() doesn't work on ICS, but works on JB

Posted by ObAt on Stack Overflow See other posts from Stack Overflow or by ObAt
Published on 2012-10-31T10:53:53Z Indexed on 2012/10/31 11:00 UTC
Read the original article Hit count: 338

Filed under:
|
|

I use this code to send parameters when I start a new Activity:

Intent inputForm = new Intent(getActivity(), InputForm.class);

Bundle b = new Bundle();
b.putInt("item", Integer.parseInt(mItem.id)); //Your id
inputForm.putExtras(b); //Put your id to your next Intent
startActivity(inputForm);

And I use this code for reading the parameters in the inputForm Activity:

    Bundle b = getIntent().getExtras();
    if (b != null) {
        int value = b.getInt("item");
        ID = value;
    }

Toast.makeText(getApplication(), "MIJN ID:" + Integer.toString(ID), Toast.LENGTH_LONG).show();

When I run this code on my Samsung Tab 10.1 GT-P7510 ID is alsways 0, when I run the same code on my Galaxy S3 with JB the code just works fine. Can someone help me?

Thanks in advance,

ObAt

© Stack Overflow or respective owner

Related posts about java

Related posts about android