in oncreate in android activity what's wrong -
i need in appps searche product , and som referces of product in anather table create both of table , when execut application logcat says problem in oncreat can me understous , how fix j
ava.lang.runtimeexception: unable start activity componentinfo{tabet.ventas/tabet.ventas.lignevente}: java.lang.nullpointerexception 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread.access$600(activitythread.java:141) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 05-19 15:20:46.934: e/androidruntime(799): @ android.os.handler.dispatchmessage(handler.java:99) 05-19 15:20:46.934: e/androidruntime(799): @ android.os.looper.loop(looper.java:137) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread.main(activitythread.java:5039) 05-19 15:20:46.934: e/androidruntime(799): @ java.lang.reflect.method.invokenative(native method) 05-19 15:20:46.934: e/androidruntime(799): @ java.lang.reflect.method.invoke(method.java:511) 05-19 15:20:46.934: e/androidruntime(799): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 05-19 15:20:46.934: e/androidruntime(799): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 05-19 15:20:46.934: e/androidruntime(799): @ dalvik.system.nativestart.main(native method) 05-19 15:20:46.934: e/androidruntime(799): caused by: java.lang.nullpointerexception 05-19 15:20:46.934: e/androidruntime(799): @ tabet.ventas.lignevente.oncreate(lignevente.java:42) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activity.performcreate(activity.java:5104) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 05-19 15:20:46.934: e/androidruntime(799): @ android.app.activitythread.performlaunchactivity(activitythread.java:2144) 05-19 15:20:46.934: e/androidruntime(799): ... 11 more
and activity lignevente
public class lignevente extends activity { sqlitedatabase dlv; edittext inputnom; edittext inputdate; edittext txtrechercheproduit; edittext nom_produit_vente; edittext quantite_stock_vente; edittext prix_ligne_vente; edittext qte_voulue; string recid="0"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.ligne_vente); txtrechercheproduit =(edittext)findviewbyid(r.id.txtrechercheproduit); nom_produit_vente=(edittext)findviewbyid(r.id.nom_produit_vente); qte_voulue=(edittext)findviewbyid(r.id.qte_voulue); prix_ligne_vente=(edittext)findviewbyid(r.id.prix_ligne_vente); txtrechercheproduit.requestfocus(); nom_produit_vente.setenabled(false); quantite_stock_vente.setenabled(false); prix_ligne_vente.setenabled(false); createdb(); qte_voulue=(edittext)findviewbyid(r.id.qte_voulue); button btn_chercher=(button)findviewbyid(r.id.btn_chercher); button btn_valid=(button)findviewbyid(r.id.valider_choix); dlv=openorcreatedatabase("produitbase.db", sqlitedatabase.create_if_necessary, null); btn_chercher.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { if (txtrechercheproduit.gettext().tostring().equals("")) { toast.maketext(lignevente.this, "entrer le produit rechercher.", toast.length_short).show(); } else { searchrecord(); } } }); btn_valid.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { if (qte_voulue.gettext().tostring().equals("")) { toast.maketext(lignevente.this, "entrer la qte vouloir acheté", toast.length_short).show(); } else { insert(); } } }); inputnom = (edittext) findviewbyid(r.id.nom); inputdate = (edittext) findviewbyid(r.id.date); button btnenvoifact = (button) findviewbyid(r.id.btnenvoyer); btnenvoifact.setonclicklistener(new view.onclicklistener() { public void onclick(view arg0) { //starting new intent intent verifierfacture = new intent(getapplicationcontext(), factureactivity.class); //envoyer nom du client et la date la facture verifierfacture.putextra("nom", inputnom.gettext().tostring()); verifierfacture.putextra("date", inputdate.gettext().tostring()); // ouvrire la fenétre facture ou nn ..!!??? startactivity(verifierfacture); } }); button btnretour = (button) findviewbyid(r.id.btn_retour); btnretour.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { // launching produit screen //@_@ intent = new intent(getapplicationcontext(), venteboxclass.class); //@_@ startactivity(i); } }); button btnvalider = (button) findviewbyid(r.id.valider_choix); button btnrecherche = (button) findviewbyid(r.id.btn_chercher); }
package tabet.ventas; import java.util.locale; import android.os.bundle; import android.app.activity; import android.content.intent; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; public class lignevente extends activity { sqlitedatabase dlv; edittext inputnom; edittext inputdate; edittext txtrechercheproduit; edittext nom_produit_vente; edittext quantite_stock_vente; edittext prix_ligne_vente; edittext prix_vente; edittext qte_voulue; string recid="0"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.ligne_vente); txtrechercheproduit =(edittext)findviewbyid(r.id.txtrechercheproduit); nom_produit_vente=(edittext)findviewbyid(r.id.nom_produit_vente); quantite_stock_vente=(edittext)findviewbyid(r.id.quantite_stock_vente); prix_ligne_vente=(edittext)findviewbyid(r.id. prix_ligne_vente); txtrechercheproduit.requestfocus(); nom_produit_vente.setenabled(false); quantite_stock_vente.setenabled(false); prix_ligne_vente.setenabled(false); createdb(); qte_voulue=(edittext)findviewbyid(r.id.qte_voulue); button btn_chercher=(button)findviewbyid(r.id.btn_chercher); button btn_valid=(button)findviewbyid(r.id.valider_choix); dlv=openorcreatedatabase("produitbase.db", sqlitedatabase.create_if_necessary, null); btn_chercher.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { if (txtrechercheproduit.gettext().tostring().equals("")) { toast.maketext(lignevente.this, "entrer le produit rechercher.", toast.length_short).show(); } else { searchrecord(); } } }); btn_valid.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { if (qte_voulue.gettext().tostring().equals("")) { toast.maketext(lignevente.this, "entrer la qte vouloir acheté", toast.length_short).show(); } else { insert(); } } }); inputnom = (edittext) findviewbyid(r.id.nom); inputdate = (edittext) findviewbyid(r.id.date); button btnenvoifact = (button) findviewbyid(r.id.btnenvoyer); btnenvoifact.setonclicklistener(new view.onclicklistener() { public void onclick(view arg0) { //starting new intent intent verifierfacture = new intent(getapplicationcontext(), factureactivity.class); //envoyer nom du client et la date la facture verifierfacture.putextra("nom", inputnom.gettext().tostring()); verifierfacture.putextra("date", inputdate.gettext().tostring()); // ouvrire la fenétre facture ou nn ..!!??? startactivity(verifierfacture); } }); button btnretour = (button) findviewbyid(r.id.btn_retour); btnretour.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { // launching produit screen //@_@ intent = new intent(getapplicationcontext(), venteboxclass.class); //@_@ startactivity(i); } }); button btnvalider = (button) findviewbyid(r.id.valider_choix); button btnrecherche = (button) findviewbyid(r.id.btn_chercher); }
Comments
Post a Comment