ProgressBar setProgress - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ProgressBar setProgress method.

This code example shows how to use the following methods:setIndeterminate, setProgress, setSecondaryProgress, setVisibility
        if (mHorizontalProgress == null) {
            return; 
        } 
        switch (value) {
            case Window.PROGRESS_VISIBILITY_ON:
                mHorizontalProgress.setVisibility(View.VISIBLE);
                break; 
 
            case Window.PROGRESS_VISIBILITY_OFF:
                mHorizontalProgress.setVisibility(View.GONE);
                break; 
 
            case Window.PROGRESS_INDETERMINATE_ON:
                mHorizontalProgress.setIndeterminate(true);
                break; 
 
            case Window.PROGRESS_INDETERMINATE_OFF:
                mHorizontalProgress.setIndeterminate(false);
                break; 
 

9
CodeRank
This code example shows how to use the following methods:getProgress, getSecondaryProgress, setIndeterminate, setProgress, setSecondaryProgress
        assertEquals(20, progressBar.getSecondaryProgress());
    } 
 
    @Test 
    public void shouldNotSetProgressWhenIndeterminate() throws Exception { 
        progressBar.setIndeterminate(true);
        progressBar.setProgress(10);
        progressBar.setSecondaryProgress(20);
        progressBar.setIndeterminate(false);
 
        assertEquals(0, progressBar.getProgress());
        assertEquals(0, progressBar.getSecondaryProgress());
    } 
 
    @Test 
    public void testIncrementProgressBy() throws Exception { 
        assertEquals(0, progressBar.getProgress());
        progressBar.incrementProgressBy(1);
        assertEquals(1, progressBar.getProgress());
        progressBar.incrementProgressBy(1);
9
CodeRank
This code example shows how to use the following methods:getLayoutParams, getWidth, getMax, getProgress, setProgress
            mChronometer.stop();
        } 
 
        // Update the ProgressBar status 
        int remaining = (int) (mDurationBase - now);
        mProgressBar.setProgress(mDuration - remaining);
         
        // Move the Chronometer if gravity is set correctly 
        if (mChronometerFollow) {
            RelativeLayout.LayoutParams params;
             
            // Calculate estimate of ProgressBar leading edge position 
            params = (RelativeLayout.LayoutParams) mProgressBar.getLayoutParams();
            int contentWidth = mProgressBar.getWidth() - (params.leftMargin + params.rightMargin);
            int leadingEdge = ((contentWidth * mProgressBar.getProgress()) /
                    mProgressBar.getMax()) + params.leftMargin;
             
            // Calculate any adjustment based on gravity 
            int adjustLeft = 0;
            int textWidth = mChronometer.getWidth();
            if (mChronometerGravity == Gravity.END) {
9
CodeRank
This code example shows how to use the following methods:setMax, setProgress, setOnSeekBarChangeListener
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
        SeekBar slider = new SeekBar(this);
        LinearLayout container = new LinearLayout(this);
        container.setOrientation(LinearLayout.VERTICAL);
        setContentView(container);
 
        container.addView(slider);
        slider.setMax(100);
        slider.setProgress(50);
        FrameLayout frame = new FrameLayout(this);
        final RenderingView gpuView = new RenderingView(this, Color.GREEN);
        frame.addView(gpuView);
        final RenderingView swView = new RenderingView(this, Color.RED);
        swView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        frame.addView(swView);
        container.addView(frame);

8
CodeRank
This code example shows how to use the following methods:setIndeterminate, setProgress, setSecondaryProgress, setVisibility
        if (mHorizontalProgress == null) {
            return; 
        } 
        switch (value) {
            case Window.PROGRESS_VISIBILITY_ON:
                mHorizontalProgress.setVisibility(View.VISIBLE);
                break; 
 
            case Window.PROGRESS_VISIBILITY_OFF:
                mHorizontalProgress.setVisibility(View.GONE);
                break; 
 
            case Window.PROGRESS_INDETERMINATE_ON:
                mHorizontalProgress.setIndeterminate(true);
                break; 
 
            case Window.PROGRESS_INDETERMINATE_OFF:
                mHorizontalProgress.setIndeterminate(false);
                break; 
 

9
CodeRank
This code example shows how to use the following methods:setMax, setProgress
			return layout;
		} 
	@Override 
		protected void onBindDialogView(View v) {
			super.onBindDialogView(v);
			mSeekBar.setMax(mMax);
			mSeekBar.setProgress(mValue);
		} 
	@Override 
		protected void onSetInitialValue(boolean restore, Object defaultValue)
		{ 
			super.onSetInitialValue(restore, defaultValue);
			if (restore)
				mValue = shouldPersist() ? getPersistedInt(mDefault) : 0;
			else 
				mValue = (Integer)defaultValue;
		} 
 
	public void onProgressChanged(SeekBar seek, int value, boolean fromTouch)
	{ 
8
CodeRank
This code example shows how to use the following methods:setProgress
                      green.getProgress(), blue.getProgress()));
  } 
   
  public void setColor(int color) {
    red.setProgress(Color.red(color));
    green.setProgress(Color.green(color));
    blue.setProgress(Color.blue(color));
    swatch.setBackgroundColor(color);
  } 
   
  private SeekBar.OnSeekBarChangeListener onMix=new SeekBar.OnSeekBarChangeListener() {
    public void onProgressChanged(SeekBar seekBar, int progress, 
                                  boolean fromUser) { 
      int color=getColor(); 
       
      swatch.setBackgroundColor(color); 
       
      if (listener!=null) { 
        listener.onColorChange(color); 
      } 
8
CodeRank
This code example shows how to use the following methods:getMax, setProgress, setVisibility
This code example shows how to use the following methods:setLayoutParams, setPadding, setMax, setProgress, setOnSeekBarChangeListener
		mValueText = new TextView(context);
		mValueText.setGravity(Gravity.RIGHT);
		mValueText.setPadding(20, 0, 20, 0);
		layout.addView(mValueText);
 
		SeekBar seekBar = new SeekBar(context);
		seekBar.setPadding(20, 0, 20, 20);
		seekBar.setLayoutParams(params);
		seekBar.setMax(1000);
		seekBar.setProgress((int)(Math.pow((float)(mValue - MIN) / (MAX - MIN), 0.25f) * 1000));
		seekBar.setOnSeekBarChangeListener(this);
		layout.addView(seekBar);
 
		updateText(); 
 
		builder.setView(layout);
	} 
 
	/** 
	 * Format seconds into a human-readable time description. 
8
CodeRank
This code example shows how to use the following methods:setMax, setProgress, setVisibility
        return mImageView;
    } 
 
 
    public void setProgress(int value, int max) {
        pb.setVisibility(View.VISIBLE);
        pb.setMax(max);
        pb.setProgress(value);
    } 
 
    public ProgressBar getProgressBar() {
        return pb;
    } 
 
    public Button getRetryButton() {
        return retry;
    } 
 
    public void setGif(String bitmapPath) {
        webView.setVisibility(View.VISIBLE);
8
CodeRank

Related ProgressBar setProgress Questions & Answers:

Other ProgressBar setProgress Examples

247:					Intent i = new Intent(getApplicationContext(), PlayListActivity.class);
248:					startActivityForResult(i, 100);
249:				}
250:			});
251:

Read More

setProgress Method Overview
Set the current progress to the specified value.
See Code Examples for other Android ProgressBar Methods: