moved sqldatabase handling into MainActivity