Skip to content Skip to sidebar Skip to footer

Chronometer Start Activity When Time Is Reached

I want a new activity to start when a new activity is reached, so far i've been having some trouble. This is what i have so far. I hope you guys understand what i am trying to do

Solution 1:

Try implementing Chronometer.OnChronometerTickListener on your Activity and put the code from chronometer() in there (or the relevant part).

public class Next extends Activity
    implements Chronometer.OnChronometerTickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        ...

        Chrono = (Chronometer) findViewById(R.id.chronometer1);
        Chrono.setOnChronometerTickListener(this);
        Chrono.start();

        ...
    }

    public void onChronometerTick(Chronometer chronometer) {
        if ("00:10".equals(chronometer.getText()) {
            // Create Intent and start the new Activity here
        }
    }
}

Post a Comment for "Chronometer Start Activity When Time Is Reached"