Issue
I have little knowledge of java scripting, and need help making my application work. I am trying to create a simple counter with 2 buttons (up and down) and a text displaying the count. I want the up button to add 1 to the count, and the down button to subtract 1 from the count.
I cannot figure out how to tie a value to my text box, and how to make the buttons add or subtract that value, do I need to create a variable for the count?
I essentially want button1's onClick to sum(count + 1) and button2's onClick to sum(count - 1)
I have figured out how to use the onClickListener, and have made it do some simple showToastMessage applications, but I am stuck on this.
Any help would be greatly appreciated
Thanks in advance, Caleb
Solution
Hey what you want to do is have a Handler which is in charge of updating the textview. So whenever the button is clicked you send a message(some form of data) to the Handler and then the handler will update the text view with that data received from the message. Here is a simple example of how to use Handler in Android: Example
Answered By - HAxxor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.