Example usage for android.widget Chronometer setOnChronometerTickListener

List of usage examples for android.widget Chronometer setOnChronometerTickListener

Introduction

In this page you can find the example usage for android.widget Chronometer setOnChronometerTickListener.

Prototype

public void setOnChronometerTickListener(OnChronometerTickListener listener) 

Source Link

Document

Sets the listener to be called when the chronometer changes.

Usage

From source file:kr.ac.kpu.wheeling.blackbox.Camera2VideoFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    mTextureView = (AutoFitTextureView) view.findViewById(kr.ac.kpu.wheeling.R.id.texture);
    //-------------------------------------------
    tracker_layout = (LinearLayout) view.findViewById(R.id.tracker_layout);
    mButtonVisible = (Button) view.findViewById(R.id.btn_visible);
    mButtonVisible.setOnClickListener(this);
    mButtonRiding = (Button) view.findViewById(R.id.btn_visible_riding);
    mButtonRiding.setOnClickListener(this);
    btn_btest = (Button) view.findViewById(R.id.btn_btest);
    btn_btest.setOnClickListener(this);
    sqLiteHandler = new SQLiteHandler(getActivity());
    //----------------------------------------------
    mButtonVideo = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.video);
    mButtonVideo.setOnClickListener(this);

    mButtonSetting = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.interval);
    mButtonSetting.setOnClickListener(this);
    //view.findViewById(R.id.info).setOnClickListener(this);
    chronometer = (Chronometer) view.findViewById(kr.ac.kpu.wheeling.R.id.chronometer);

    sensorManager.registerListener(gyroListener, sensor, SensorManager.SENSOR_DELAY_NORMAL);
    mButtonGallery = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.menu);
    mButtonGallery.setOnClickListener(this);
    galleryActivity = new Intent(getActivity(), GalleryActivity.class);

    chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
        @Override/*ww w .  j a  v  a 2  s. com*/
        public void onChronometerTick(Chronometer chronometer) {
            if ((int) (((SystemClock.elapsedRealtime() - chronometer.getBase()))) > 10500) {
                try {
                    stopRecordingVideo();
                    mIsSensorChanged = false;
                } catch (Exception e) {

                }
                chronometer.stop();
            }
        }
    });
}