The key must be an application-specific resource id

The reason you’re not able to use setTag(int, Object) is because android require a pre-compiled unique id in the ‘int’ argument.

Try creating two unique entry in String.xml xml say, “firstname” & “secondname” & use them as below

imageView.setTag(R.string.firstname, "Abhishek");
imageView.setTag(R.string.lastname, "Gondalia");

Leave a Comment