Set visibility of progress bar gone on completion of image loading using Glide library

Question is rather old, and I don’t know what was the situation with glide in those times, but now it can be easily done with listener (not as proposed in the answer chosen as correct). progressBar.setVisibility(View.VISIBLE); Glide.with(getActivity()) .load(args.getString(IMAGE_TO_SHOW)) .listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return … Read more

android – save image into gallery

MediaStore.Images.Media.insertImage(getContentResolver(), yourBitmap, yourTitle , yourDescription); The former code will add the image at the end of the gallery. If you want to modify the date so it appears at the beginning or any other metadata, see the code below (Cortesy of S-K, samkirton): https://gist.github.com/samkirton/0242ba81d7ca00b475b9 /** * Android internals have been modified to store images in … Read more

android: create circular image with picasso

Research a bit before as there are answers available. Anyhow, follow This Link and read it carefully to know how to use it. try this: import com.squareup.picasso.Transformation; public class CircleTransform implements Transformation { @Override public Bitmap transform(Bitmap source) { int size = Math.min(source.getWidth(), source.getHeight()); int x = (source.getWidth() – size) / 2; int y = … Read more

Android: Generate random color on click?

Random rnd = new Random(); paint.setARGB(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); or Random rnd = new Random(); int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); view.setBackgroundColor(color); Though in your case it seems that you want to create a new drawable and assign it to your view. What is actually the drawable in your case? Is it an image, … Read more

Replace selector images programmatically

As far as I’ve been able to find (I’ve tried doing something similar myself), there’s no way to modify a single state after the StateListDrawable has already been defined. You can, however, define a NEW one through code: StateListDrawable states = new StateListDrawable(); states.addState(new int[] {android.R.attr.state_pressed}, getResources().getDrawable(R.drawable.pressed)); states.addState(new int[] {android.R.attr.state_focused}, getResources().getDrawable(R.drawable.focused)); states.addState(new int[] { }, … Read more