public class IncommingChatsViewHolders extends RecyclerView.ViewHolder implements View.OnClickListener{
public ImageView CountryCode;
public TextView Name;
public TextView VisitorID;
public TextView StartTime;
private SparseBooleanArray selectedItems = new SparseBooleanArray();
public IncommingChatsViewHolders(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
CountryCode = (ImageView) itemView.findViewById(R.id.IV_country_incomming);
Name = (TextView) itemView.findViewById(R.id.TV_name_incomming);
VisitorID = (TextView) itemView.findViewById(R.id.TV_visitor_id_incomming);
StartTime = (TextView) itemView.findViewById(R.id.TV_start_time_incomming);
}
@Override
public void onClick(View view) {
int position = getAdapterPosition();
String visitor_id = VisitorID.getText().toString();
String visitor_name = Name.getText().toString();
String start_time = StartTime.getText().toString();
Log.d("ZD-clicked : ", "Position => "+String.valueOf(position)+", Ticket Id => "+visitor_id+", StartTime : "+ StartTime);
ChatsTab chatsTab = new ChatsTab();
chatsTab.incomming_item_clicked(visitor_id, start_time);
}
}
答案 0 :(得分:3)
您的gradle.build中有几个支持库声明。 Here是如何确定问题原因的一个很好的指南。
您也可以尝试这个简单的解决方法:
android {
dexOptions {
preDexLibraries = false
}
}
答案 1 :(得分:0)
按照以下步骤操作 java.lang.NoClassDefFoundError: okhttp3.internal.Util
您已启用" multiDexEnabled true"并且很可能你没有在Application类中安装它。
这就是你应该做的事情
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true //You have already did this
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1' // add this in dependencies
}
最后扩展应用程序
public class YouApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
这是一本很好的指南https://developer.android.com/studio/build/multidex.html