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.

Enyang Mercy
Courses Plus Student 2,339 PointsAndroid log class name...simpleName
Part 2 seems difficult. Just did Part one successfully but part2 has an error. A simpleName method has been used as instructed instead of hard-coding to get the class name. Error: make sure you're using the class name/type mismatch
import android.app.Activity
import android.os.Bundle
class TreehouseActivity : Activity() {
val TAG = TreehouseActivity:: class.java.simpleName
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_treehouse)
Log.d(TAG, "Activity created!")
}
}
2 Answers

Steve Hunter
57,684 PointsHi there,
Your code passed the challenge for me but the challenge seems to be having intermittent problems. I had to try a few times before it went through OK.
Steve.
val TAG = TreehouseActivity::class.java.simpleName

Enyang Mercy
Courses Plus Student 2,339 PointsThanks Steve. I don't know why kotlin keep having errors. I would have chosen java rather than kotlin.