Results 1 to 8 of 8
Thread: Break counter
- 04-01-2014, 08:18 PM #1
Member
- Join Date
- Apr 2014
- Posts
- 7
- Rep Power
- 0
- 04-01-2014, 08:25 PM #2
Re: Break counter
Please see the link in my signature on asking questions the smart way, then try again.
How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 04-01-2014, 08:26 PM #3
Senior Member
- Join Date
- Feb 2014
- Posts
- 219
- Rep Power
- 8
Re: Break counter
Please post here what you have tried.
- 04-01-2014, 08:30 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: Break counter
how about counter= (counter+1)%30?
kind regards,
JosLast edited by JosAH; 04-01-2014 at 08:56 PM. Reason: flappy fingers ...
Build a wall around Donald Trump; I'll pay for it.
- 04-01-2014, 08:35 PM #5
Member
- Join Date
- Apr 2014
- Posts
- 7
- Rep Power
- 0
Re: Break counter
final TextView tvw=(TextView)findViewById(R.id.textView1);
Button btnv=(Button)findViewById(R.id.button1);
btnv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
do{tvw.setText("" + m);
m++;
}while(m<33);
}});}
- 04-01-2014, 08:42 PM #6
Re: Break counter
That looks like Android code.
Do you want the contents of the TextView to show the last value that was set in the loop
or do you want to see a progression of numbers shown in the TextView with a delay between the changes
or do you want the value shown to change with every button click?If you don't understand my response, don't ignore it, ask a question.
- 04-01-2014, 08:44 PM #7
Member
- Join Date
- Apr 2014
- Posts
- 7
- Rep Power
- 0
Re: Break counter
I want the value shown to change with every button click
Last edited by amirnazarizadeh; 04-01-2014 at 08:56 PM.
- 04-01-2014, 08:56 PM #8
Re: Break counter
If the number should change at each button click, have the listener change the value and show the new value. If the value is to wrap from 30 to 0, add an if statement in the listener to handle that.
The value should be preserved in a class level variable.If you don't understand my response, don't ignore it, ask a question.
Similar Threads
-
Help with constructor counter.
By lannie1980 in forum New To JavaReplies: 3Last Post: 05-05-2012, 11:33 PM -
Writing a counter
By Pojahn_M in forum New To JavaReplies: 4Last Post: 05-03-2011, 04:56 PM -
Increment Counter for ID
By blkshrk81 in forum New To JavaReplies: 6Last Post: 12-01-2010, 02:25 AM -
How to Add a Counter to a Variable?
By Bbob in forum New To JavaReplies: 22Last Post: 06-05-2010, 04:14 PM -
Counter
By ks1615 in forum New To JavaReplies: 6Last Post: 02-20-2009, 04:02 AM
Bookmarks