I am using Recycler View and it is showing error: Type parameter T has incompatible upper bound: View and RecyclerView.
Following is the code:
public class RecyclerView extends AppCompatActivity {
ArrayList<Contact> list=new ArrayList<Contact>();
RecyclerView recyclerView;
android.support.v7.widget.RecyclerView.Adapter adapter;
android.support.v7.widget.RecyclerView.LayoutManager layoutManager;
int[] image_id = {R.drawable.asd, R.drawable.download};
String[] name, email, mobile;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler_view);
name = getResources().getStringArray(R.array.person_name);
email = getResources().getStringArray(R.array.person_email);
mobile = getResources().getStringArray(R.array.person_mobile);
int count=0;
for (String name: name)
{
Contact contact =new Contact(image_id[count],name,email[count],mobile[count]);
count++;
list.add(contact);
}
recyclerView = findViewById(R.id.rv_view);
}
}
XML FILE:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".RecyclerView">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rv_view">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
I am not using Data Binding.