Code example for ProgressBar

Methods: setIndeterminatesetVisibility, setLayoutParams

0
 
		mImage = new ImageView(mContext);
		mImage.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
 
		mSpinner = new ProgressBar(mContext);
		mSpinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
 
		mSpinner.setIndeterminate(true);
 
		addView(mSpinner);
		addView(mImage);
 
		if (imageUrl != null) {
			setImageDrawable(imageUrl);
		} 
	} 
 
	/** 
	 * Set's the view's drawable, this uses the internet to retrieve the image 
	 * don't forget to add the correct permissions to your manifest 
	 *  
	 * @param imageUrl 
	 *            the url of the image you wish to load 
	 */ 
	public void setImageDrawable(final String imageUrl) {
		mDrawable = null;
		mSpinner.setVisibility(View.VISIBLE);
		mImage.setVisibility(View.GONE);
		new Thread() {
			public void run() { 
				try { 
					mDrawable = getDrawableFromUrl(imageUrl);