Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Simple Android App with Java Testing and Debugging Writing to the Log

log

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.

am failing to see my errors on this challenge

com/teamtreehouse/TreehouseActivity.java
package com.teamtreehouse;

public class TreehouseActivity extends Activity {

  public static final String TAG = TreehouseActivity.class.getSimpleName();

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_treehouse);
    Log.d( TAG , msg:"Activity created()")
  }
}

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,705 Points

It looks like you just need to edit your string that you're passing into your tag. You're using parentheses as you would if you were calling a method!. :-)

thanks Jonathan for replying am still failing to pass after trying your solution cn you please show me what you are saying by correcting my code and sending me the corrected

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,705 Points

You need to remove the `msg: bit from your string. It looks like this is a code marker from Android Studio that's been copied into the code challenge. That just means it's expecting a message in a string as the parameter.

So to pass you just need

    Log.d( TAG, "Activity created!");