Compare ImageView Backgrounds?

PharCyDeD

Active Member
Licensed User
Longtime User
How would you go about comparing two ImageView backgrounds? For instance, I tried:

B4X:
If ImageView1.Bitmap = ImageView2.Bitmap Then
Label1.Text = "Yes"
End If

and

B4X:
If ImageView1.Background = ImageView2.Background Then
Label1.Text = "Yes"
End If

I am not getting any results with this...any help? :BangHead:


I am using:

B4X:
ImageView1.SetBackgroundImage(LoadBitmap(File.DirAssets, "Krazy_Triangles_[48]_021.png"))

To set the backgrounds if that helps.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
The bitmaps will be two separate objects, even if the contents are the same (the same image). Comparing ImageView1.Bitmap = ImageView2.Bitmap is actually comparing the pointers to the objects so will always be different.

The Background and bitmap are different objects as well (I think).

The easiest way would probably be to record the filename loaded in the ImageViews Tag Property at the time of loading then compare that.
 
Last edited:
Upvote 0
Top