android - Error in displaying data after fetching it from the Sqlite DataBase -
throwing fatal error while going display message using textview.. iam using program sets loger also.it run upto logger="lastmark".
private void displaytext(string message){ logger.info("inside display message"); textview textview = (textview)findviewbyid(r.id.name_1); logger.info("last mark"); textview.settext(message); } public void callstatus(){ logger.info("inside 3 rd step"); database = databasemanager.instance(); logger.info("inside 4 rd step"); //to data database need cursor. //after perform select query data database specific query, in cursor // "*" means "all" in translation query means "select name table" cursor = database.select("select * " + table_name); logger.info("inside 4b rd step"); string s =""; logger.info("inside 5 rd step"); //the cursor iterates column "name" while (cursor.movetonext()){ do{ //in string record each row column "name" logger.info("inside 6 rd step"); string s1 = cursor.getstring(cursor.getcolumnindex(column_name1)); string s2 = cursor.getstring(cursor.getcolumnindex(column_name2)); s = s1+s2; }while (cursor.movetonext()); logger.info("inside 7 rd step"); //in textview added, updated or deleted string // "\n" means "new line" } //here close cursor because not longer need cursor.close(); logger.info("inside 8 rd step"); displaytext(s); } }
....throwing fatal error while going display message using textview.. iam using program sets looger also.it run upto logger="lastmark".
try this:
after creating cursor
if (cursor.movetofirst()) { { // column1 , column2 .... } while (cursor.movetonext()) }
and make sure close cursor after cursor operations.