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 Kotlin Basic Android Programming Making a Button Do Something

Marek Feifrlik
Marek Feifrlik
5,798 Points

In case you're getting "Type inference failed" error

I was receiving the following and app wouldn't compile:

Error:(18, 28) Type inference failed: Not enough information to infer parameter T in fun <T : View!> findViewById(p0: Int): T!Please specify it explicitly.

Fixed it by replacing: factTextView = findViewById(R.id.factTextView) as TextView

With: factTextView = findViewById<TextView>(R.id.factTextView)

Same goes for the showFactButton variable, use <Button>.

1 Answer

Louis Stanko
Louis Stanko
518 Points

thank you very much. :)