android - Show sqlite database records using cursor -


i not able show records of sqlite table

my mysqlitehelper class

public cursor showimagerecords() {     cursor cursor=db.query(table_name, new string[]{column1, column2}, null, null, null, null, null, null);     return cursor; } 

i calling selection query as

public void showimages() {     mysqlitehelper mysqlitehelper=new mysqlitehelper(context, null, null, 1);     mysqlitehelper.opendatabase();         cursor cursor=mysqlitehelper.showimagerecords();      while(cursor.movetonext())     {         imagepath=cursor.getstring(1);         imagedate=cursor.getstring(2);          txtdetails.settext(imagepath+ "  " + imagedate +"\n");     }     cursor.close();     mysqlitehelper.closedatabase(); } 

logcat shows

06-04 16:05:33.402: e/androidruntime(4954): fatal exception: timer-0 06-04 16:05:33.402: e/androidruntime(4954): android.view.viewrootimpl$calledfromwrongthreadexception: original thread created view hierarchy can touch views. 06-04 16:05:33.402: e/androidruntime(4954):     @ android.view.viewrootimpl.checkthread(viewrootimpl.java:5351) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.view.viewrootimpl.invalidatechildinparent(viewrootimpl.java:1001) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.view.viewgroup.invalidatechild(viewgroup.java:4189) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.view.view.invalidate(view.java:10507) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.view.view.invalidate(view.java:10456) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.widget.textview.checkforrelayout(textview.java:6517) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.widget.textview.settext(textview.java:3729) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.widget.textview.settext(textview.java:3587) 06-04 16:05:33.402: e/androidruntime(4954):     @ android.widget.textview.settext(textview.java:3562) 06-04 16:05:33.402: e/androidruntime(4954):     @  

any advice , suggestions welcome

replace

mysqlitehelper mysqlitehelper=new mysqlitehelper(context, null, null, 1); 

to

mysqlitehelper mysqlitehelper=new mysqlitehelper(); 

also displaying log cat error good

check tutorial


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -