Android Build a Simple Android App with Java Testing and Debugging Writing to the 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

package com.teamtreehouse;

public class TreehouseActivity extends Activity {

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

  public void onCreate(Bundle savedInstanceState) {
    Log.d( TAG , msg:"Activity created()")

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 85,481 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 85,481 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!");