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 trialprosper nyamukondiwa
656 Pointswriting the log anybody to help with a correct answer
Inside the onCreate() method (after the setContentView() call), log the message "Activity created!" using the Log debug method (remember it's just one letter). The 1st parameter should be "TreehouseActivity", but use the TAG variable instead of typing it out a second time. The 2nd parameter is the message.
package com.teamtreehouse;
public class TreehouseActivity extends Activity {
public static final String TAG = "TreehouseActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_treehouse);
}
} log.d.tag "Activitycreated", msg; TreehouseActivity;
2 Answers
Ken Alger
Treehouse TeacherProsper;
A couple of things with the above code.
- First, your log statement should be on the line after
setContentView
and before the closing braces.
- Second, double check the syntax of your Log statement. The
Log.d
method's signature is, in this case,Log.d(String tag, String msg)
.
Post back with further questions if you're still stuck.
Happy coding,
Ken
prosper nyamukondiwa
656 Pointshave reached a dead end , exhausted my brain the answer is not coming through
Ken Alger
Treehouse TeacherLog.d(TAG, "Activity created!");
Is what the Log statement syntax should look like.
prosper nyamukondiwa
656 PointsHELLO ken am still facing a challenge ,can you help by puttig as it should be the whole code coz i cant figure where am getting it wrong
Ken Alger
Treehouse TeacherProsper;
I don't want to just give you the answer outright. ;-)
Here's another hint.
package com.teamtreehouse;
public class TreehouseActivity extends Activity {
public static final String TAG = "TreehouseActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_treehouse);
// LOG STATEMENT GOES HERE
}
}
prosper nyamukondiwa
656 Pointsprosper nyamukondiwa
656 Pointsthanks so much , let me try answer the next question