Is there an onImageChangedListener() on a ImageView?
I need the event when the image is changed from the ImageView.
setImageResource(0); qImageView. setImageResource(R. drawable.
ImageView class is used to display any kind of image resource in the android application either it can be android. graphics. Bitmap or android. graphics. drawable.
How to show the full size image in popup on clicking the image in android. Below is the code that will show the full size image in a dialog box popup without defining layout xml file . int a=v. getId(); intiger "a" will have the value equal to profile_pic if we touched on profile_pic imageview else we will get pro id .
There is no default listener in Android .. but we can create the imagechange listiner .. copy the class and instead of using ImageView use MyImageView..
public class MyImageView extends ImageView {
private OnImageChangeListiner onImageChangeListiner;
public MyImageView(Context context) {
super(context);
}
public MyImageView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public void setImageChangeListiner(
OnImageChangeListiner onImageChangeListiner) {
this.onImageChangeListiner = onImageChangeListiner;
}
@Override
public void setBackgroundResource(int resid) {
super.setBackgroundResource(resid);
if (onImageChangeListiner != null)
onImageChangeListiner.imageChangedinView(this);
}
@Override
public void setBackgroundDrawable(Drawable background) {
super.setBackgroundDrawable(background);
if (onImageChangeListiner != null)
onImageChangeListiner.imageChangedinView(this);
}
public static interface OnImageChangeListiner {
public void imageChangedinView(ImageView mImageView);
}
}
Check the imageview code in grepcode. You don't know when it is changed or redrawn. It is because after you setImageDrawable(), imageview will invalidate. At this time, the image IS NOT CHANGED correctly until ondraw is called.
Anyway, why do you want to know the onimagechangedlistener?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With