有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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

我创建了一个适配器,里面有一个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) 个答案