如何在适配器中获取textview的值?

时间:2016-05-03 20:36:48

标签: java android textview android-recyclerview adapter

我在其中创建了一个带有textview的适配器,并将Textview传递给我的投票方法,如下所示,但是,我得到的响应是textview的名称,而不是textview的值。我该如何解决这个问题?

 class ViewDashboard extends RecyclerView.ViewHolder{
    private TextView question;

    public ViewDashboard(View itemView){
        super(itemView);
        questionText=(TextView)itemView.findViewById(R.id.questionText);

        Voting s=new Voting();
    s.Like(getAdapterPosition(),ViewpagerAdapter.this,questionId);

投票类

 public void Like(final int position,final RecyclerView.Adapter adapter, TextView textViewId){
   //the questionId, that we pass in is a textview, therefore, we need to convert it to a String
   final String stringId=textViewId.getText().toString();

0 个答案:

没有答案