AnalogClock - how do i set it to show 18:50 in my app and never change?

by Richard » Wed, 05 Aug 2009 00:21:38 GMT


Sponsored Links
 Hi

I would like to show an Analog clock in my android app and set it to a
specific time, say 18:50 and never change.
I have created an AnalogClock view and added it to the activity but it
only ever shows the current time and I can't find a function call
change it to the time I want. Is it even possible?

I would have assumed that it would be something like below but these
functions dont exist (or work that wat).

AnalogClock clock = (AnalogClock)findViewById(R.id.clock);

clock.setHour(18);
clock.setMinute(50);

or

clock.setTime("18:50");

or even

SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Date myDateTime = df.format("18:50");

clock.setTime(myDateTime);

Am I barking up the wrong tree by trying to use the AnalogClock view
for something is not designed to do? If so is there a different way to
achieve what I want?

I guess I would need to extend the AnalogClock class to make it show a
specific time of my choosing. Problem is I wouldnt know where to
start.

I feel like I have missed something stupidly obvious but I have been
looking at it so long I cant see it :-)

Any help would be appreciated

Thanks

Richard

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Still looking for a USB/modem tethering solution

I moved from Windows Mobile to Android and the only thing I miss is
WM's simple to use modem, which permits easy connection of the phone
to a laptop to permit Internet access using the phone's 3G connection.

I've searched for a few solutions for the G1 but they're all complex
or don't work very well. My latest attempt involved PDANet, which
constantly drops the connection and works very slowly.

Is there anything better - that doesn't involve a hacked phone?

I have a 3Gb data plan so I don't see why I can't use this allowance
any way I like.

Bobby
--~--~---------~--~----~------------~-------~--~----~

2. G1 & BT headset call button (attn: Nick Pelly)






Nick are you still out there?

--~--~---------~--~----~------------~-------~--~----~

3. how to have icons in buttons?

4. ActivityGroup + embedded Activity search window

5. Instrumentation for Dialog's and alike

6. How to share non-sqlite( shared Preference) data over Content Provider.

7. How to share non-sqlite( shared Preference) data over Content Provider.