


You can download the source code using the below link. MainActivity class has method “AddData” which calls databasecontroller’s method to add the company name.įillList method will populate Android ListView from SQLite Database using dbController.getCompanies() method. Toast.makeText(MainActivity.this, ex.getMessage().toString(), Toast.LENGTH_SHORT).show() ĭatabaseController class will create android sqlite database and methods accepting string values for adding a new company name into database. R.layout.list_template, c, CompanyName, id, 0)

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, SQLiteDatabase sqlDb = dbController.getReadableDatabase() Public class DatabaseController extends SQLiteOpenHelper ĭbController = new DatabaseController(this) Now we will create the database class file which will create our SQLite Database and methods to add and fetch the add from our Android SQLite database to view on Listview.
