I am running the below code. There are two snippets. The first is how I am setting the bundle and the second how I am retrieving it. For some reason every time i check the bundle it returns as null.
Any advice on why this is or what I have done wrong would be greatly appreciated.
Intent intent = new Intent(this, com.hom.app.Hom.class);
Bundle b = new Bundle();
b.putString("WELL", "yes");
intent.putExtras(b);
startActivity(intent);
Retrieving Bundle:
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();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…