@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_story);
Intent intent = getIntent();
String name = intent.getStringExtra("name");
if (name == "d")
{
name = "Spike";
}
TextView heading = (TextView) findViewById(R.id.storyTextView);
heading.setText("And our story begins with " + name);
Asked
Active
Viewed 27 times
0

Ivar
- 6,138
- 12
- 49
- 61
-
You can't really compare strings usings == sign (this is the way to compare their references. Use it like this: "d".equals(name) – scana Dec 21 '15 at 15:57
-
If you had used "Angel" instead of Spike, it would've worked. Just kidding, check the comments above about what's really wrong. – Rick Sanchez Dec 21 '15 at 16:35