Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Button Event not working  RSS feed

 
Ryan Lemon
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I click the Button "CreateLG", I'm trying to make the TextView "GetStarted" disappear, but it's not working-when I hit the button, nothing happens. Can anyone help me understand why not?

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan Lemon wrote:When I click the Button "CreateLG", I'm trying to make the TextView "GetStarted" disappear, but it's not working-when I hit the button, nothing happens. Can anyone help me understand why not?



Does the onClick() method get executed? Does the case in the switch get executed? You can either use breakpoints and a Debugger to find out the course of code execution, or you can log values to LogCat to track what lines get executed.
 
Ryan Lemon
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm... you're right, onClick() isn't even executed. I put a break point in the method (@ the third line, final int), but got nothing. Maybe I'm supposed to have something different for the "View v" that's getting passed in or how it's being handled??

It seems pretty simple, but nothing's happening at all, it's practically the only thing I actually have in my code as all my designing so far's been in XML.
 
Ron McLeod
Saloon Keeper
Posts: 1527
210
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan Lemon wrote:When I click the Button "CreateLG", I'm trying to make the TextView "GetStarted" disappear, but it's not working-when I hit the button, nothing happens. Can anyone help me understand why not?


Have you defined an onClick handler for the button - either programatically or in the layout file?
 
Ryan Lemon
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha... I had the listener defined for the other buttons but not it, dumb mistake. Thanks again for your help Steve . I'm a total newbie to Android and have only programmed in VB.NET, which was much easier considering VS does most of the UI programming for you..
 
brevity is the soul of wit - shakepeare. Tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!