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 trialLyric Abbott
35,595 PointsTesting and Debugging
Inside the onCreate() method (after the setContentView() call), log the message "Activity created!" using the Log debug method (remember that 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.
The Code:
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);
} }
I dont understand this
2 Answers
Daniel Hartin
18,106 PointsOkay so on the line after setContentView(R.layout.activity_treehouse); You want to type the following Log.d(TAG, "Activity Created!");
This line is a method call where we are passing in parameters for the method to use. Log is the class, d is the method, the use of parentheses () mean a method call.
The method in this instance takes 2 parameters the TAG variable which has been defined for you earlier in the code, and then the message which the challenge states yo should use "Activity Created!".
Hope this helps Daniel
Juan Gallardo
1,568 Pointspackage 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, "Activity Created!");
}
}
channonhall
12,247 PointsThanks For helping Juan!
channonhall
12,247 PointsThanks For helping Juan!