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 trial

Android Build a Simple Android App (2014) Testing and Debugging Writing to the Log

Inside the onCreate() method (after the setContentView() call), log the message "Activity created!" using the Log debug

What should I do ??!!

com/teamtreehouse/TreehouseActivity.java
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.tag,"Activity created");
    Log.d(TAG,"Activity created");

  }
}

``` 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.

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.

4 Answers

Sean M
Sean M
7,344 Points

The code challenges can be specific with the wording.

The final code is:

    Log.d(TAG, "Activity created!");
AHMED ELBADWI
AHMED ELBADWI
979 Points

You just forgot to add the exclamation mark "!" .

Avraham Sedaghat
Avraham Sedaghat
4,217 Points

It seems that you have already added the Log debug statement with the correct tag and message. That's all you need to do. Please clarify your question if you still have a problem. Good luck.

Spoiler Alert:

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,"Activity created!");

  }
}