Issue
I have an UI with some TextViews and I want to test if a textView has a certain drawable resource as background. I'm using the following code, but the tag
is always null.
Object tag = textView.getTag();
int backgroundId = R.drawable.bg_image_2;
if( tag != null && ((Integer)tag).intValue() == backgroundId) {
//...do something...
}else{
//...do something...
}
Which method returns the R.drawable
background id number of an object? What am I doing wrong?
Solution
Tag is a feature for developer to save some object with Widget, you have use setTag() to save an arbitary object with UI widget. If you didn't setTag(), then getTag() would return NULL.
Answered By - TieDad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.