Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVincent Phung
1,685 PointsI keep getting the error "illegal start of type" for the start of the if line and Log.d "cannot resolve symbol d"
public class StoryActivity extends Activity {
public static final String TAG = StoryActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_story);
}
Intent intent = getIntent();
String name = intent.getStringExtra(getString(R.string.key_name));
if(name == null) {
name = "Friend";
}
Log.d(TAG, name);
}
1 Answer
Steve Hunter
57,712 PointsHi Vincent,
I think your code should inside of the onCreate
method. Move your new lines inside of that method.
Organise your imports too - that will make the Log.d
work, I think.
Hope that helps.
Steve.