Countdown-Timers in Android

Ich die Umsetzung countdown-timer, sondern seine nicht funktioniert für mich. Unten ist der code.

package FinalProj.com;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.os.CountDownTimer;

public class iFallApp extends Activity{
    public TextView textView1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //TextView textview = new TextView(this);
        //textview.setText("This is the iFall tab");
       //setContentView()
        setContentView(R.layout.ifallapp);

        textView1=(TextView) findViewById(R.id.textView1);

        MyCount counter = new MyCount(5000,1000);
        counter.start();


    }

    public class MyCount extends CountDownTimer{
        public MyCount(long millisInFuture, long countDownInterval) {
            super(millisInFuture, countDownInterval);
            }

        iFallApp app1 = new iFallApp();

        @Override
        public void onFinish() {
            //TODO Auto-generated method stub

            textView1.setText("done");
        }

        @Override
        public void onTick(long millisUntilFinished) {
            //TODO Auto-generated method stub

            textView1.setText((int) (millisUntilFinished/1000));

        }
    }

}
Wie genau ist das Fehlverhalten?
Nach dem Start der Anwendung wird beendet... es gibt einige problem mit der onTick-Methode... wenn ich den Kommentar dann die Anwendung funktioniert gut...

InformationsquelleAutor tech_learner | 2011-05-07

Schreibe einen Kommentar