Thanks for the info, I ended up getting everything running but I'm not to
sure if doing it the way I did will stop execution of everything else. I
just set it to loop the clock like this:
I setup the handler:
time clock = new time();
Handler hand = new Handler();
hand.postDelayed(clock, 1000);
Then I have in my runnable time I have this to loop it:
String time = ((int)vHour + ":" + (int)vMin + ":" + (int)vSec);
TextView tv = new TextView(context);
tv.setText(time);
setContentView(tv);
Handler hand = new Handler();
hand.postDelayed(this, 100);
Of course I left some code out I don't want a huge wall of text for everyone
to read, but is there a better way of doing this? It seems once the handler
is called for clock it would stop execution of the rest of the program and
would just loop for ever in the clock.
On Mon, Nov 3, 2008 at 8:38 AM, bryan <[EMAIL PROTECTED]> wrote:
>
> I was playing with TimerTask for the first time the other day. It pops
> up a dialog after 30 seconds. May help you figure out what to do.
> About the emulator, you don't have to restart it each time. After it
> starts up once, just leave it open. After that, when you are ready to
> run your app, it'll load into the running emulator fairly quick.
>
> handler = new Handler();
> t = new Timer();
> t.schedule(new TimerTask() {
> public void run() {
> handler.post(new Runnable() {
> public void run() {
> killListener();
> showDialog(DIALOG_DELAY);
> }
> });
> }
> }, 30000);
>
> On Nov 2, 5:54 am, Peter <[EMAIL PROTECTED]> wrote:
> > Hello everyone, I'm some what new to java and very new to android. I'm
> > trying to create a Clock for a MMO I play. I was able to get it
> > running with the normal java debugger but seeing I don't have
> > ActionListener I had to use TimerTask which I'm new to.
> >
> > I want my program to simply just display the time and in text format
> > nothing special or cool. It seems to "run" fine, but the Timer doesn't
> > seem to be functioning properly.
> >
> > Anyway here is a link to the code:
> http://pastebin.ca/1243143http://pastebin.com/m386d7fd7
> >
> > Also is there a way to test programs without the emulator? I need to
> > test my apps a lot since I'm new and having to wait for the emulate to
> > start is very time consuming.
> >
> > Any help on how to setup the Timer properly I would be very grateful!
> >
> > Thanks!
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---