私は以下のコードを実行しています。 2つのスニペットがあります。 1つ目はバンドルを設定する方法、もう1つは取得方法です。何らかの理由でバンドルをチェックするたびにnullとして返されます。Androidのインテントバンドルは常にnullですか?
これが何であるか、私が間違っていたことについてのアドバイスは、非常に高く評価されます。
Intent intent = new Intent(this, com.hom.app.Hom.class);
Bundle b = new Bundle();
b.putString("WELL", "yes");
intent.putExtras(b);
startActivity(intent);
取得バンドル:それはnullを返すことになる理由
String well ="";
Bundle bun = getIntent().getExtras();
String standard = "yes";
if(bun != null){
Log.v("Bundle", "Contains data");
well = bun.getString("WELL");
if(well == null) well = "";
if(well == standard) method();
}
を使用していませんか? – JoeLallouz