Code example for ProgressBar

Methods: getContextisIndeterminatesetIndeterminatesetProgress

0
	} 
 
	@Override 
	public Context getContext() {
		if (mProgress != null) {
			return mProgress.getContext();
		} 
		return null; 
	} 
 
	@Override 
	public boolean isAvailable() { 
		if (null == mProgress) {
			Log.e(TAG, "R.id.progress_bar is missing");
			return false; 
		} 
		return true; 
	} 
 
	public static int calProgressBySize(int total, int maxSize, List<?> list) {
		if (null != list) {
			return (MAX - (int) Math.floor(list.size() * (total / maxSize)));
		} 
		return MAX;
	} 
 
	private void resetProgressBar() { 
		if (mProgress.isIndeterminate()) {
			// TODO: 第二次不会出现 
			mProgress.setIndeterminate(false);
		} 
		mProgress.setProgress(0);
	} 
 
	private void showMessage(CharSequence text) {
		Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show();
	} 
Connect your IDE to all the code out there  Get Codota for Java