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

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(;




or even

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


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

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




Other Threads

1. Closed WTS : Motorola Milestone

Selamat malam rekan-rekan,

Sesuai subjek yang tadi siang, saya ingin memberitahukan bahwa Motorola
Milestone yang saya tawarkan sudah terjual.

Terima kasih kepada rekan-rekan dan moderator.


"Indonesian Android Community [id-android]" 

2. Anrdoid AppWidget setPendingIntent didn't work until reboot

I'm creating an AppWidget application. It has a button which launches
external activity.
Here is code:

            Intent clickintent = new Intent(Intent.ACTION_MAIN);

            PendingIntent pendingIntentClick =
                    context, 0, clickintent, 0);


The question is: why this code working ONLY after reboot of
device(testing on HTC Legend Anroid 2.1) or Emulator(2.1, 2.2. On 1.5
i can't reproduce thath)?
Before reboot just nothing happens. In LogCat i see nothing on
pressing button - no errors, warnings, infos or anything.
After reboot all works fine.

Any ideas?


3. Froyo 2.2 disables requestWindowFeature(Window.FEATURE_NO_TITLE);

4. DexClassLoader- ActiivityNotFound

5. How to cleanly finish an activity? (activity timeouts prevent restarting an app)

6. Notification for the Message sent by SMS toolkit

7. Beta Testing Request - TextWand