当前位置: 首页>>代码示例>>Java>>正文


Java Chronometer.start方法代码示例

本文整理汇总了Java中android.widget.Chronometer.start方法的典型用法代码示例。如果您正苦于以下问题:Java Chronometer.start方法的具体用法?Java Chronometer.start怎么用?Java Chronometer.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Chronometer的用法示例。


在下文中一共展示了Chronometer.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
/**
 * Called on create of the Activity. Sets up the activity
 * with its layout. Also sets up and starts the chronometer to tick
 * and check the time. If it's over 3 seconds it'll close.
 */
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	setContentView(R.layout.page_splash);
	this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
	
	Chronometer chrono = (Chronometer) findViewById(R.id.chronometer_splash_chrono);
	chrono.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
		
		public void onChronometerTick(Chronometer chronometer) {
			counter++;
			if(counter > 2) {
				Intent intent = new Intent(Splash.this, Main.class);
				Splash.this.startActivity(intent);
				Splash.this.finish();
			}
		}
	});
	chrono.start();
}
 
开发者ID:lsissoko,项目名称:Life-Preserver-Diet,代码行数:25,代码来源:Splash.java

示例2: setChronometer

import android.widget.Chronometer; //导入方法依赖的package包/类
private static void setChronometer(Chronometer chronometer, int mode) {
    switch (mode) {
        case Constant.CHRONOMETER_START:
            if (playTime != 0) {
                chronometer.setBase(chronometer.getBase() +
                        (SystemClock.elapsedRealtime() - playTime));
            } else {
                chronometer.setBase(SystemClock.elapsedRealtime());
            }
            chronometer.start();
            break;
        case Constant.CHRONOMETER_STOP:
            chronometer.stop();
            playTime = SystemClock.elapsedRealtime();
            break;
        case Constant.CHRONOMETER_RESET:
            chronometer.stop();
            chronometer.setBase(SystemClock.elapsedRealtime());
            playTime = 0;
            break;
        default:
            break;
    }
}
 
开发者ID:lpy19930103,项目名称:MinimalismJotter,代码行数:25,代码来源:RecoderManager.java

示例3: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // The ViewModelStore provides a new ViewModel or one previously created.
    ChronometerViewModel chronometerViewModel
            = ViewModelProviders.of(this).get(ChronometerViewModel.class);

    // Get the chronometer reference
    Chronometer chronometer = findViewById(R.id.chronometer);

    if (chronometerViewModel.getStartTime() == null) {
        // If the start date is not defined, it's a new ViewModel so set it.
        long startTime = SystemClock.elapsedRealtime();
        chronometerViewModel.setStartTime(startTime);
        chronometer.setBase(startTime);
    } else {
        // Otherwise the ViewModel has been retained, set the chronometer's base to the original
        // starting time.
        chronometer.setBase(chronometerViewModel.getStartTime());
    }

    chronometer.start();
}
 
开发者ID:googlecodelabs,项目名称:android-lifecycles,代码行数:26,代码来源:ChronoActivity2.java

示例4: onCreateView

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragmentView = inflater.inflate(R.layout.misc_overscroll_demo, null, false);

    View textView = fragmentView.findViewById(R.id.demo_text);
    OverScrollDecoratorHelper.setUpStaticOverScroll(textView, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);

    View imageView = fragmentView.findViewById(R.id.demo_image);
    OverScrollDecoratorHelper.setUpStaticOverScroll(imageView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

    mChrono = (Chronometer) fragmentView.findViewById(R.id.demo_chronometer);
    if (savedInstanceState != null) {
        mChrono.setBase(savedInstanceState.getLong(CHRONO_TIME_SAVE_ID));
    }
    OverScrollDecoratorHelper.setUpStaticOverScroll(mChrono, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);
    mChrono.start();

    return fragmentView;
}
 
开发者ID:EverythingMe,项目名称:overscroll-decor,代码行数:20,代码来源:MiscViewsDemoFragment.java

示例5: onPostCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
	super.onPostCreate(savedInstanceState);

	// Trigger the initial hide() shortly after the activity has been
	// created, to briefly hint to the user that UI controls
	// are available.
       // Set text of quick timer
       Chronometer qt = (Chronometer) findViewById(R.id.quicktimer);
       if (!mQuickTimerRunning) {
       	qt.setText("Quick Timer");
       }
       else {
       	String timeFields[] = mElapsedTime.split(":");
       	qt.setBase(SystemClock.elapsedRealtime() 
       			- Integer.parseInt(timeFields[0])*60000 - Integer.parseInt(timeFields[1])*1000);
       	qt.start();
       }
}
 
开发者ID:sw-devendra,项目名称:SpeechTimer,代码行数:20,代码来源:MainActivity.java

示例6: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrinterLogger.setLogLevel(PrinterLogger.LEVEL_VERBOSE);
    ZoomLogger.setLogLevel(ZoomLogger.LEVEL_ERROR);

    setContentView(R.layout.activity_main);
    mDocument = findViewById(R.id.pdf_preview);
    mJpegPrinter = new JpegPrinter(mDocument, this);
    mPngPrinter = new PngPrinter(mDocument, this);
    mPdfPrinter = new PdfPrinter(mDocument, this);

    mDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
    mFilename = "my-document-" + System.currentTimeMillis();

    findViewById(R.id.print_jpeg).setOnClickListener(this);
    findViewById(R.id.print_pdf).setOnClickListener(this);
    findViewById(R.id.print_png).setOnClickListener(this);
    findViewById(R.id.edit).setOnClickListener(this);
    findViewById(R.id.logo_prompt).setOnClickListener(this);

    Chronometer chrono = findViewById(R.id.chrono);
    chrono.start();

    mPanel = findViewById(R.id.controls);
    mPanel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            BottomSheetBehavior b = BottomSheetBehavior.from(mPanel);
            b.setState(BottomSheetBehavior.STATE_HIDDEN);
            mPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
    setupControls();
}
 
开发者ID:natario1,项目名称:ViewPrinter,代码行数:36,代码来源:MainActivity.java

示例7: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Log.v(LOG_TAG, "in onCreate");
    mChronometer = new Chronometer(this);
    mChronometer.setBase(SystemClock.elapsedRealtime());
    mChronometer.start();
}
 
开发者ID:Truiton,项目名称:BoundService,代码行数:9,代码来源:BoundService.java

示例8: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Chronometer chronometer = findViewById(R.id.chronometer);

    chronometer.start();
}
 
开发者ID:googlecodelabs,项目名称:android-lifecycles,代码行数:10,代码来源:ChronoActivity1.java

示例9: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_capturer);

    capturedView = (LinearLayout) findViewById(R.id.captured_view);
    videoView = (VideoView) findViewById(R.id.video_view);
    timerView = (Chronometer) findViewById(R.id.timer_view);
    timerView.start();

    // Once added we should see our linear layout rendered live below
    localVideoTrack = LocalVideoTrack.create(this, true, new ViewCapturer(capturedView));
    localVideoTrack.addRenderer(videoView);
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:15,代码来源:CustomCapturerVideoActivity.java

示例10: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey5);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.

}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:11,代码来源:Survey5Activity.java

示例11: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey12);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:10,代码来源:Survey12Activity.java

示例12: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey7);
   
    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:10,代码来源:Survey7Activity.java

示例13: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey17);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:10,代码来源:Survey17Activity.java

示例14: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey1);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:10,代码来源:Survey1Activity.java

示例15: onCreate

import android.widget.Chronometer; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey3);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
开发者ID:JuKyYoon,项目名称:Pineapple,代码行数:10,代码来源:Survey3Activity.java


注:本文中的android.widget.Chronometer.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。