0
Having a
imagem = (ImageView) findViewById(R.id.imageViewId);
How do I know if the current image has the name x or y?
I tried some ways with the equals and stuff, but it didn’t work....
if (imagem.equals("nome")){...
0
Having a
imagem = (ImageView) findViewById(R.id.imageViewId);
How do I know if the current image has the name x or y?
I tried some ways with the equals and stuff, but it didn’t work....
if (imagem.equals("nome")){...
1
I suppose when you say "image name" you’re referring to the ID assigned by android:id
or setId()
, in this case R.id.imageViewId
.
If so, use the method imagem.getId()
to obtain the assigned ID:
if (imagem.getId() == R.id.imageViewId){...
Why not the equals()
?
@RBZ equals()
, in this case, serves to verify if they are the same instance.
Browser other questions tagged android image imageview
You are not signed in. Login or sign up in order to post.
But the idea is to compare images ? It was assigned directly in the layout?
– Isac
The image will be set dynamically. If the chosen one is X I want to do an action...
– I Wanna Know
What exactly are you trying to do?
– Pablo Almeida