Kurlicue Kurlicue - 1 year ago 64
Android Question

Match an int value to a text tag

How do I match an int value to a Tag? For example, when seting the visibility of a view, VISIBLE actually return 2, GONE returns 0, etc

How can I do this so I can make my code more easily to read?

Answer Source
public static final int TAG_NAME = 3

Another thing to consider might be to use an enum. This can minimize incorrect use of tags. e.g. Expecting one of three tags which equal 0, 1, and 2; but a user passes in 3.