📜  android gridview viewholder button onclick - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:49.041000             🧑  作者: Mango

代码示例1
//add a viewholder to your adapter!!!!!!!!!!!!!!!!

        holder.button = convertView.findViewById(R.id.group_button);
        holder.button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bundle bundle = new Bundle();
                bundle.putString("buttonText", holder.button.getText().toString());
                ChatRoomFragment chatRoomFragment = new ChatRoomFragment();
                chatRoomFragment.setArguments(bundle);
                ((NavigationHost) context).navigateTo(chatRoomFragment, true);
            }
        });