NumberFormatException in setTag(int key, Object tag) method

来源:互联网 发布:seo网络优化培训 编辑:程序博客网 时间:2024/06/11 07:20

来源:https://stackoverflow.com/questions/27599832/numberformatexception-in-settagint-key-object-tag-method

翻译:chrome


报错

public static final String FIRST_TAG = "TAGTEST";imageView.setTag(Integer.parseInt(FIRST_TAG.toString()), myIndex);

解决
key 必须是 Android ID.

你能使用一个 [视图的一个Id] R.id.somethingfromyourviews

或者

创建一个id xml 文件, 通常称为 ids.xml 位置在 res\values .

 <resources>    <item type="id" value="integer" name="your_id_name"/> </resources>

end

阅读全文
0 0
原创粉丝点击