Skip to content

Instantly share code, notes, and snippets.

@kundansviet
Last active January 14, 2017 09:07
Show Gist options
  • Save kundansviet/f8f8016100da16925a8d234b62f77b27 to your computer and use it in GitHub Desktop.
Save kundansviet/f8f8016100da16925a8d234b62f77b27 to your computer and use it in GitHub Desktop.
Recyclerview with checkbox
package com.cb.recyclerwithcheckbox;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private List<String> productList;
private RecyclerView rv_product_list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
productList = new ArrayList<>();
for (int i = 0; i < 500; i++) {
productList.add("product "+i);
}
rv_product_list = (RecyclerView) findViewById(R.id.rv_product_list);
rv_product_list.setLayoutManager(new LinearLayoutManager(this));
rv_product_list.setAdapter(new ListAdapter(this,productList));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment