Skip to main content

Posts

Showing posts from August, 2013

Featured post

Simple RecyclerView example with filter option in Android

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&ltNumber&gt numbers = new ArrayList&lt&gt(); 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

Simple SQLiteHelper example in android

SQLiteHelper.jar This jar has the following functions. 1. public SQLiteHelper(Context context, String dbname, CursorFactory factory, int version) This constructor is used to initialize SQLiteOpenHelper class. 2. public void createTable(String table_name, String[] fields, String[] types) This method is used to create table with fields. Total number of fields and types must be equal. 3. public ArrayList&ltHashMap&ltString, Object&gt&gt getFields(String table_name) This method will return all fields with their types as ArrayList. 4. public String insertData(String table_name, String[] fields, String[] data) This method used to insert record in our table. This will return a String as Transaction successfully completed if the transaction completed. Otherwise it will return exception. 5. public ArrayList&ltHashMap&ltString, Object&gt&gt getAllData(String table_name) This method used to get all record from our table as arraylist. 6. public Array