通过单击按钮生成的结果值,输入recyclerview

时间:2019-06-03 08:38:02

标签: java android android-recyclerview

我不知道如何在Adapter的TextView中插入值

class ButtonSearchClickListener implements View.OnClickListener {


        Context context;

        public ButtonSearchClickListener(Context context) {
            this.context = context;
        }

        @Override
        public void onClick(View v) {

            String match = editSearch.getText().toString();

            for (int i = 0; i < arrayName.size(); i++) {

                if (match != null && match.equals(arrayName.get(i))) {

                    for (int j = 0; j < arrayUser.size(); j++) {

                        hide.setText(" 검색결과입니다 \n" + "\n" + "성명: " + arrayUser);
                        Log.d("name", "name" + hide);

                    }
                } else if (match != null && match.equals(arrayGender.get(i))) {
                    for (int j = 0; j < arrayUser.size(); j++) {

                        hide.setText(" 검색결과입니다 \n" + "\n" + arrayUser);
                        Log.d("gender", "gender" + hide);
                    }
                } else if ((match != null) && (Integer.valueOf(match) == Integer.valueOf(arrayAge.get(i)))) {
                    for (int j = 0; j < arrayUser.size(); j++) {

                        hide.setText(" 검색결과입니다 \n" + "\n" + arrayUser);
                        Log.d("age", "age" + hide);
                    }
                } else {
                    Toast.makeText(MainActivity.this, "검색조건에 해당하는 정보가없습니다. 다시입력해주세요", Toast.LENGTH_SHORT).show();

                }
            }


        }
    } /// search button Listener


 private ArrayList<String> getData() {

        final ArrayList<String> userInfo = new ArrayList<>();
        userInfo.clear();

        if (hide != null) {
            String asd = String.valueOf(hide);

            userInfo.add(asd);
        }
        return userInfo;
    }  

///这个RecyclerView适配器,我想将Click listener的值放在RecyclerView Adapter中。

0 个答案:

没有答案