How to set multiple tags to a button?

后端 未结 4 1620
既然无缘
既然无缘 2021-02-07 07:12

I have 16 buttons and I tag them to pair some terms set to buttons and imported from sqlite database. So, I tag them like this:

// labelForButton and tagForButto         


        
4条回答
  •  执笔经年
    2021-02-07 08:08

    Define the key id in strings.xml and then get it through the id example:

    In String.xml declare the following code

    
    
    
    

    now set the tag like following

     share.setTag(R.id.date,it.adjournDate);
     share.setTag(R.id.name,it.partyName);
    

    Share is my button name

    Now finally get the tag in button where you want these values listener like this:

    v.getTag(R.id.name)
    v.getTag(R.id.date)
    

提交回复
热议问题