如何使用onclicklistener在recyclerview中更新/设置数据库子文本?

时间:2017-03-27 17:58:22

标签: android firebase firebase-realtime-database android-recyclerview

所以我正在尝试将一个onclicklistener更新数据库子项从回收站视图更新为特定文本,但我有点卡住任何帮助将不胜感激

   public BlogViewHolder(View itemView) {
        super(itemView);
        mView = itemView;
        textView_title = (TextView) itemView.findViewById(R.id.title);
        textView_decription = (TextView) itemView.findViewById(R.id.description);
        textView_address =(TextView) itemView.findViewById(R.id.address);
        textView_phone =(TextView) itemView.findViewById(phone);
        textView_Pickup =(TextView) itemView.findViewById(pickup);
        textView_Confirm =(TextView) itemView.findViewById(confirm);
        bconfirm = (Button) itemView.findViewById(R.id.bcomfirm);
        bpickup = (Button) itemView.findViewById(R.id.bpickup);


        bpickup.setOnClickListener(this);
        bconfirm.setOnClickListener(this);


    }
    //new
    @Override
    public void onClick(View v) {
        if (View == bpickup){
            //set action

这是我坚持的地方。我只是不确定设置更新数据库子代的操作的代码。

1 个答案:

答案 0 :(得分:0)

# Create a list to store the data
groupings = []

# For each row in the column,
for row in df['column2']:
    # if more than a value,
    if row < 20:
        # Append a letter grade
        groupings.append('1')
    else: 
        groupings.append('0')