Showing posts from August, 2013

Simple SQLiteHelper example in android


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 ArrayList&ltH…