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 with Java Testing and Debugging Writing to the Log

prosper nyamukondiwa
prosper nyamukondiwa
656 Points

help please is this the 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";

  public void onCreate(Bundle savedInstanceState) {

    Log.d(tag:"Activitycreated"; msg :"TreehouseActivity!; 


1 Answer

There are a few issues with your log statement:

  1. "tag" should be "TAG"
  2. Remove the colon after "tag" - You must use a comma.
  3. Delete "Activitycreated" - I'm not sure how you came up with that, it has no business here.
  4. Delete "msg" - "msg" is just a nice UI feature within Android Studio, it does not compile with the code.
  5. Delete the colon after "msg" - We only use commas between the Log Method parentheses.
  6. Delete "TreehouseActivity!
  7. The challenge asks us not to repeat the value of the "TAG" variable listed above which is "TreehouseActivity"
  8. After TAG, you are asked to display the message they have listed.

Reading through these 8 key points you are left with this skeleton:

Log.d(TAG, "_______");

What message does the challenge ask you to display?

I would love if you selected my response for best answer!