无法在行'viewHolder.itemClickListener =(ItemClickListener)(view,position); {'

时间:2018-09-26 11:15:07

标签: android

在'viewHolder.itemClickListener =(ItemClickListener)(view,position); {'行处无法解析符号'view'。我的编码问题出了什么主意?

<?php

namespace App;

use Illuminate\Database\Eloquent\Relations\Pivot;

class PostUser extends Pivot
{
    // other definitions related
}

3 个答案:

答案 0 :(得分:0)

在viewHolder之后使用组件ID:

             viewHolder.YOUR_COMPONENT_NAME(LIKE EDITTEXT).itemClickListener=(ItemClickListener)(view, position);{
                //if model is current user, not set click event
                if (!model.getEmail().equals(FirebaseAuth.getInstance().getCurrentUser().getEmail())) {
                    Intent map = new Intent(ListOnline.this, MapTracking.class);
                    map.putExtra("email", model.getEmail());
                    map.putExtra("lat", mLastLocation.getLatitude());
                    map.putExtra("lng", mLastLocation.getLongitude());
                    startActivity(map);
                }

答案 1 :(得分:0)

您是否已将视图类导入到您的类中...如果未导入

答案 2 :(得分:0)

//Resolved by implementing setOnClickListener of the root View
viewHolder.txtEmail.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
              if(!model.getEmail().equals(FirebaseAuth.getInstance().getCurrentUser().getEmail())){

                       ......
              } 
        }
  }