Count Down timer in list view

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Count Down timer in list view

Postby anurahim » Wed Mar 18, 2009 1:14 pm

Hi,
I want to add a count down timer in a list view. the time duration is got from an xml in the format (PnYnMnDTnHnMnS). I used joda-time.jar for parsing the time from Period.

I used

long totaltimeinmilliseconds = (H*24*60+M*60+S)*1000;

new CountDownTimer(totaltimeinmilliseconds, 1000) {

public void onTick(long millisUntilFinished) {
mTimer.setText("left: " + millisUntilFinished / 1000);
}

public void onFinish() {
mTimer.setText("done!");
}
}.start();


This code for making the countdown timer display.

I put the code just before

ll.addView(mTimer, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));

in which, this linearlayout ll is used for making the list.


But my problem is if there is only 1 item in the list , the timer will count down in each sec, but for more than one item, the dislpay wil be in the interval of 3 or more seconds.how can i make it display in each seconds???

Also I want to display in H:M:S format, with H,M,S synchronised.



thanx in advance
anur
anurahim
Junior Developer
Junior Developer
 
Posts: 24
Joined: Fri Jun 27, 2008 11:26 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests