Code example for Chronometer

Methods: getLayoutParamsgetWidthrequestLayoutstop

0
					"Expecting child ProgressBar with id 'android.R.id.progress'"); 
		}// Stop Chronometer if we're past duration 
		 
		long now = SystemClock.elapsedRealtime();
		if (now >= mDurationBase) {
			mChronometer.stop();
		} 
		int remaining = (int) (mDurationBase - now);
 
		mProgressBar.setProgress(mDuration - remaining);
 
		if (mChronometerFollow) {
			RelativeLayout.LayoutParams params;
			params = (RelativeLayout.LayoutParams) mProgressBar
					.getLayoutParams();
 
			int contentWidth = mProgressBar.getWidth()
					- (params.leftMargin + params.rightMargin);
 
			int leadingEdge = ((contentWidth * mProgressBar.getProgress()) /
 
			mProgressBar.getMax()) + params.leftMargin;
 
			int adjustLeft = 0;
 
			int textWidth = mChronometer.getWidth();
 
			if (mChronometerGravity == Gravity.RIGHT) {
 
				adjustLeft = -textWidth;
 
			} else if (mChronometerGravity == Gravity.CENTER_HORIZONTAL) {
 
				adjustLeft = -(textWidth / 2);
 
			} 
 
			leadingEdge += adjustLeft;
 
			int rightLimit = contentWidth - params.rightMargin - textWidth;
 
			if (leadingEdge < params.leftMargin) {
				leadingEdge = params.leftMargin;
			} else if (leadingEdge > rightLimit) {
				leadingEdge = rightLimit;
			} 
 
			params = (RelativeLayout.LayoutParams) mChronometer
					.getLayoutParams();
 
			params.leftMargin = leadingEdge;
 
			mChronometer.requestLayout();
 
		} 
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java