The key must be an application-specific resource id

后端 未结 10 1462
时光说笑
时光说笑 2020-11-29 18:11

Why do I get this Exception?

05-18 20:29:38.044: ERROR/AndroidRuntime(5453): java.lang.IllegalArgumentException: The key must be an application-specific reso         


        
10条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 18:39

    Here is a simple workaround that works for me:

    int tagKey = "YourSimpleKey".hashCode();
    
    myView.setTag(tagKey, "MyTagObject");
    

    the important clue here is to call .hashCode(); on the String

提交回复
热议问题