Intent Bundle returns Null every time?

Posted by Max on Stack Overflow See other posts from Stack Overflow or by Max
Published on 2011-11-12T17:42:48Z Indexed on 2011/11/12 17:51 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

I have some extras sent to a new intent. There it grabs the bundle and tests if it is null. Every single time it is null even though I am able to get the values passed and use them.

Can anyone see what is wrong with the if statement?

Intent i = getIntent();
Bundle b = i.getExtras();
int picked = b.getInt("PICK");
int correct = b.getInt("CORR");
type = b.getString("RAND");
if(b == null || !b.containsKey("WELL")) {
    Log.v("BUNDLE", "bun is null");
} else {
    Log.v("BUNDLE", "Got bun well");
}

EDIT: Heres where the bundle is created.

    Intent intent = new Intent(this, app.pack.son.class);
    Bundle b = new Bundle();
    b.putInt("PICK", pick);
    b.putInt("CORR", corr);
    b.putString("RAND", "yes");
    intent.putExtras(b);
startActivity(intent);

© Stack Overflow or respective owner

Related posts about java

Related posts about android