새로운 의도로 일부 엑스트라를 보냈습니다. 거기서 그것은 번들을 잡아서 null
인지 테스트합니다. 매번 값을 얻고 사용할 수는 있지만 null
입니다.Intent Bundle은 매번 Null을 반환합니까?
if 서술문에 어떤 문제가 있는지 누가 알 수 있습니까?
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 : 번들이 생성되는 곳.
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);
번들을 생성 (전송)하는 코드를 입력하십시오. –