android-Button's clickevent of listView using BaseAdapter

后端 未结 5 1752
陌清茗
陌清茗 2021-01-17 02:22

I am using Listview With custom Adapter which contain imageview,textview and 3 button (insert,update,delete)requirement is that custom adapter is call every

5条回答
  •  情书的邮戳
    2021-01-17 03:20

    set the tag for each view in get view method by setTag()

    @Override
        public View getView(int position, View convertView, ViewGroup parent) {
    
    
            if (convertView == null) {                            
                LayoutInflater inflater = context.getLayoutInflater();
                convertView = inflater.inflate(.....);
            } 
    
            ur_view= (views) convertView.findViewById(R.id.....);
                    ur_view.setTag(position);
    
            ur_view.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    //do something
                }
            }); 
    

    It will work

提交回复
热议问题