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

Cassandra Gugoff
Cassandra Gugoff
600 Points

Hello! I have entered the same exact thing that the video shows and am getting an error message of "Inconvertible types"

It says showFactButton never used

What have you tried so far? (Post your code so i can help) and what are you trying to achieve ?

Cassandra Gugoff
Cassandra Gugoff
600 Points

Button showFactButton = (Button) findViewById(R.id.showFactButton);

Does this look right?

1 Answer

Your code looks correct however you're doing little errors, you have:

Button showFactButton = (Button) findViewById(R.id.showFactButton);

Really, you should have:

Button newFactButton = (Button) findViewById(R.id.showFactButton);

The reason why you're getting an error is simply because you're naming your new button "showFactButton" and then your trying to find the view by id called 'showFactButton" so in other words, you're basically setting the name of the button the same as the name of a button you're looking for as 'showFactButton' already exists so you shouldn't be trying to create a new one.

Hope this helps