My Goal: display time in second on the screen and display battery (in my
game) left. (its a time limit)
My problem: the battery is only updating at certain times (like when I click
open or close my in game menu, which just takes a layout and makes it
visible and then invisible)
My Second problem: I have no Idea how to make a text view update the time
properly, just about every time the game crashes,

Here Is some of my code if it helps.(I took out stuff that was not relevant)
........
public TextView mTime;
 private  static long timelimit;
public  static int  batteryleft;
public  static int timeleft;
private int BLock = 0;
......
onCreate(){
........
    timelimit = 30000;
    MyCount counter = new MyCount(timelimit,1000);
counter.start();
.......
}

// this is in the main loop
private void batteryUpdate(){
 ImageView batteryfill  = (ImageView) findViewById(R.id.batteryfill);
 batteryfill.setMinimumWidth(batteryleft);
 batteryfill.setMaxHeight(batteryleft);
// batteryfill.refreshDrawableState();  // this did not do anything
....
....
 }

// my actual count down timer
public static final class MyCount extends CountDownTimer{

public MyCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public final void onFinish() {
System.out.println("Finished");
}
@Override
public final void onTick(long millisUntilFinished) {
batteryleft =  (int) ((double)millisUntilFinished/timelimit * 130);
    timeleft = (int) (millisUntilFinished/1000);
// mTime.setText(timeleft)     // I dont know where to put the constructor
for m time
}
 }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to