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

Prosper moyo
Prosper moyo
1,876 Points

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 83,362 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!. :-)

Prosper moyo
Prosper moyo
1,876 Points

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 83,362 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!");