android - how to call getWritableDatabase() from a different thread or intent service, App crashing on calling it in the main thread -
this main activity import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.edittext; import android.widget.textview; public class mainactivity extends appcompatactivity { edittext myinput; textview mytext; mydbhandler dbhandler; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myinput =(edittext) findviewbyid(r.id.myinput); mytext =(textview) findviewbyid(r.id.mytext); dbhandler= new mydbhandler(this, null, null, 1); printdatabase(); } //add product database public void addstuff(view view) { products product = new products(myinput.gettext().tostring()); dbhandler.addproduct(product); printdatabase(); } //delete items database public void deletestuff(view view) { string inputtex...