Hi Guys, Maybe you all are expert in terms of using RecyclerView in android. This blog is simple example for using filter option with RecyclerView adapter. As for now you will instantiate RecyclerView and set the adapter to RecyclerView as following way. RecyclerView list = (RecyclerView) findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(this)); list.setHasFixedSize(true); ArrayList<Number> numbers = new ArrayList<>(); String ONEs[] = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN"}; String TENs[] = {"ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY", "HUNDRED"}; String HUNDREDS[] = {"ZERO", "HUNDRED", "TWO HUND...
Like Multiple array also we can create and use multiple arraylist.
Declaration of Multiple ArrayList in JAVA.
Declaration of Multiple ArrayList in JAVA.
ArrayList<integer> sets[];
initialization of Multiple ArrayList in JAVA.
sets = new ArrayList[5];
Sample program using Multiple ArrayList in JAVA.
public class A { static ArrayList<integer> numbers[]; public static void main(String[] args) throws ParseException { numbers= new ArrayList[5]; numbers[0] = new ArrayList<integer>(); numbers[0].add(1); // extending your code in order to use more than one value of the List array numbers[1] = new ArrayList<integer>(); numbers[1].add(2); numbers[1].add(3); // if you want to get the values of first array. for(int i = 0;i<numbers[1].size();i++) System.out.println(numbers[1].get(i)); // if you want to get the values of whole arraylist. for(int j = 0; j<sets.length;j++) for(int i = 0;i<numbers[j].size();i++) System.out.println(numbers[j].get(i)); } }
Comments
Post a Comment