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. Making new keyboard

Hi to all,

I would like to make new soft keyboard and I would like to know how
they show two characters on one key, one on press and one on long key
press.
I know that I can make images for each key but I would like to avoid
that is there any settings in xml for each key to have second
character on long press?


Thanks
Igor

-- 

2. Two listviews scrolling in lockstep

I have two narrow, equally sized listviews side by side. I chose that design 
specifically because it's not a lot of information and I can show most of 
the contents in one screen full (together both lists have 22 items)

As it is now, each list is scrolling independently. It's ok-ish but I would 
like to scroll them at the same time, no matter which of the two lists I 
touch.

Telling a list to scroll to a particular pixel (or dp?) position is easy - 
smoothScrollTo(x,y).  
http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29

However I have a hard time to find out the current scroll position of a list 
view (in particular the y value). Can you please suggest where to look? 

-- 

3. [WTS] Htc Thunderbolt Ruim.

4. LG Optimus 3D Release Date Confirmed: June 6

5. New to Android Need Help

6. Background service interaction - Activity paused

7. Running Instrumentation Test on multiple emulator on desktop.