本文介绍了在SQLite数据库的错误插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从一个表单的答案与Android的应用程序。这里是code,我用:
包com.stage.sondage; 进口android.app.Activity; 进口android.content.Intent; 进口android.database.sqlite.SQLiteException; 进口android.os.Bundle; 进口android.view.View; 进口android.view.View.OnClickListener; 进口android.widget.Button; 进口android.widget.EditText; 进口android.widget.RadioButton; 进口android.widget.RadioGroup; 进口android.widget.Toast; 公共类问卷延伸活动{ //创建D'UNE例如德马CLASSE SurveyAdapter SurveyAdapter调查=新SurveyAdapter(本); 鸭preciation AP preciation =新的接入点preciation(); 公共无效的onCreate(包savedInstanceState){ super.onCreate(savedInstanceState); 的setContentView(R.layout.questions); //我们想上广播组部件的参考 RadioGroup中mRadioGroup1 =(RadioGroup中)findViewById(R.ap preciation.rep1); RadioGroup中mRadioGroup2 =(RadioGroup中)findViewById(R.ap preciation.rep2); RadioGroup中mRadioGroup3 =(RadioGroup中)findViewById(R.ap preciation.rep3); RadioGroup中mRadioGroup4 =(RadioGroup中)findViewById(R.ap preciation.rep4); RadioGroup中mRadioGroup5 =(RadioGroup中)findViewById(R.ap preciation.rep5); 单选按钮B1 =(单选)findViewById(mRadioGroup1.getCheckedRadioButtonId()); AP preciation.setRep1((字符串)b1.getText()); 单选按钮B2 =(单选)findViewById(mRadioGroup1.getCheckedRadioButtonId()); AP preciation.setRep1((字符串)b2.getText()); 单选按钮B3 =(单选)findViewById(mRadioGroup1.getCheckedRadioButtonId()); AP preciation.setRep1((字符串)b3.getText()); 单选按钮B4 =(单选)findViewById(mRadioGroup1.getCheckedRadioButtonId()); AP preciation.setRep1((字符串)b4.getText()); 单选按钮B5 =(单选)findViewById(mRadioGroup1.getCheckedRadioButtonId()); AP preciation.setRep1((字符串)b5.getText()); 的EditText区=(EditText上)findViewById(R.ap preciation.zone); AP preciation.setZone(zone.getText()的toString()); AP preciation.setLatitude(0); AP preciation.setLongitude(0); OnClickListener ButtonEnregistrer =新OnClickListener(){ 公共无效的onClick(查看actuelView){ //在ouvre拉基地去données倒écrirededans survey.open(); //在insère乐里弗阙L'上vient德créer survey.insertAp preciation(AP preciation); //在检录LA基地去données survey.close(); 意向意图=新的意图(Questionnaire.this,Questionnaire.class); startActivity(意向); } }; 按钮enregistrer =(按钮)findViewById(R.ap preciation.enregistrer); enregistrer.setOnClickListener(ButtonEnregistrer); } }下面是调查适配器类的code:
包com.stage.sondage; 进口android.content.ContentValues; 进口android.content.Context; 进口android.database.Cursor; 进口android.database.sqlite.SQLiteDatabase; 进口android.database.sqlite.SQLiteDatabase.CursorFactory; 公共类SurveyAdapter { // NOM德拉表 公共静态最后弦乐AP preCIATION_TABLE_NAME =鸭preciation; 公共静态最后弦乐COLUMN_IDAP preCIATION =IDAP preCIATIONL; 公共静态最终诠释NUM_COLUMN_IDAP preCIATION = 0; 公共静态最后弦乐COLUMN_ZONE =ZONE; 公共静态最终诠释NUM_COLUMN_ZONE = 1; 公共静态最后弦乐COLUMN_LATITUDE =纬度; 公共静态最终诠释NUM_COLUMN_LATITUDE = 2; 公共静态最后弦乐COLUMN_LONGITUDE =经度; 公共静态最终诠释NUM_COLUMN_LONGITUDE = 3; 公共静态最后弦乐COLUMN_REP1 =REP1; 公共静态最终诠释NUM_COLUMN_REP1 = 4; 公共静态最后弦乐COLUMN_REP2 =REP2; 公共静态最终诠释NUM_COLUMN_REP2 = 5; 公共静态最后弦乐COLUMN_REP3 =REP3; 公共静态最终诠释NUM_COLUMN_REP3 = 6; 公共静态最后弦乐COLUMN_REP4 =REP4; 公共静态最终诠释NUM_COLUMN_REP4 = 7; 公共静态最后弦乐COLUMN_REP5 =REP5; 公共静态最终诠释NUM_COLUMN_REP5 = 8; 私人SQLiteDatabase BDD; 私有AP preciationOpenHelper maBaseSQLite; 公共SurveyAdapter(上下文的背景下){ //在créer拉BDD等山表 maBaseSQLite =新的接入点preciationOpenHelper(背景下,NULL); } 公共无效的open(){ //在ouvre拉BDD恩女性写作 BDD = maBaseSQLite.getWritableDatabase(); } 公共无效的close(){ //在检录L'ACCES点菜BDD bdd.close(); } 公共SQLiteDatabase getBDD(){ 返回BDD; } 众长insertAp preciation(AP preciation应用程序){ //创建D'未ContentValues(fonctionne COMME UNE的HashMap) ContentValues值=新ContentValues(); //对吕ajoute UNE valeurassocié单UNE CLE(魁EST乐NOM德拉Colonne的丹斯laquelle上veut mettre LA valeur) values.put(COLUMN_ZONE,app.getZone()); values.put(COLUMN_LATITUDE,app.getLatitude()); values.put(COLUMN_LONGITUDE,app.getLongitude()); values.put(COLUMN_REP1,app.getRep1()); values.put(COLUMN_REP2,app.getRep2()); values.put(COLUMN_REP3,app.getRep3()); values.put(COLUMN_REP4,app.getRep4()); values.put(COLUMN_REP5,app.getRep5()); //在insèreL'OBJET丹斯LA BDD通过乐ContentValues 返回bdd.insert(AP preCIATION_TABLE_NAME,空,价值观); } }
这里的鸭类precationOpenHelper的code:
包com.stage.sondage; 进口android.content.Context; 进口android.database.sqlite.SQLiteDatabase; 进口android.database.sqlite.SQLiteOpenHelper; 进口android.database.sqlite.SQLiteDatabase.CursorFactory; 公共类鸭preciationOpenHelper扩展SQLiteOpenHelper { //版本德拉基地去données 私有静态最终诠释DATABASE_VERSION = 1; //乐舍曼德拉基地去donnée 私有静态字符串DB_PATH =/data/data/com.stage.sondage/databases/; // NOM德拉基地 私有静态最后弦乐SURVEY_BASE_NAME =survey.db; // NOM德拉表 公共静态最后弦乐AP preCIATION_TABLE_NAME =鸭preciation; //说明DES Colonnes酒店 公共静态最后弦乐COLUMN_IDAP preCIATION =IDAP preCIATIONL; 公共静态最后弦乐COLUMN_ZONE =ZONE; 公共静态最后弦乐COLUMN_LATITUDE =纬度; 公共静态最后弦乐COLUMN_LONGITUDE =经度; 公共静态最后弦乐COLUMN_REP1 =REP1; 公共静态最后弦乐COLUMN_REP2 =REP2; 公共静态最后弦乐COLUMN_REP3 =REP3; 公共静态最后弦乐COLUMN_REP4 =REP4; 公共静态最后弦乐COLUMN_REP5 =REP5; //RequêteSQL倒拉CRÉATION哒啦基地 私有静态最后弦乐REQUETE_CREATION_BDD =CREATE TABLE+ AP preCIATION_TABLE_NAME +(+ COLUMN_IDAP preCIATION +INTEGER PRIMARY KEY AUTOINCREMENT,+ COLUMN_ZONE +TEXT NOT NULL,+ COLUMN_LATITUDE +双NOT NULL,+ COLUMN_LONGITUDE +双NOT NULL,+ COLUMN_REP1 +TEXT NOT NULL, + COLUMN_REP2 +TEXT NOT NULL,+ COLUMN_REP3 +TEXT NOT NULL, + COLUMN_REP4 +TEXT NOT NULL,+ COLUMN_REP5 +TEXT NOT NULL);; 公共鸭preciationOpenHelper(上下文的背景下,CursorFactory厂){ 超(背景下,SURVEY_BASE_NAME,工厂,DATABASE_VERSION); // TODO自动生成构造函数存根 } @覆盖 公共无效的onCreate(SQLiteDatabase DB){ // TODO自动生成方法存根 db.execSQL(REQUETE_CREATION_BDD); } @覆盖 公共无效onUpgrade(SQLiteDatabase分贝,INT oldVersion,诠释静态网页){ // TODO自动生成方法存根 如果(动态网页> DATABASE_VERSION){ db.execSQL(DROP TABLE+ AP preCIATION_TABLE_NAME +;); 的onCreate(DB); } } }
这里是鸭类preciation: 包com.stage.sondage;
公共类鸭preciation { 私人诠释IDAP preciation; 私人字符串区; 私人双重纬度; 私人双经度; 私人字符串REP1; 私人字符串REP2; 私人字符串rep3; 私人字符串rep4; 私人字符串rep5; 公共鸭preciation(字符串区,双纬度,双经度,字符串REP1,REP2字符串,字符串rep3,字符串rep4,字符串rep5){ this.zone =区; this.latitude =纬度; this.longitude =经度; this.rep1 = REP1; this.rep2 = REP2; this.rep3 = rep3; this.rep4 = rep4; this.rep5 = rep5; } 公共鸭preciation(){ // TODO自动生成构造函数存根 } 公众诠释getIdap preciation(){ 返回IDAP preciation; } 公共无效setIdap preciation(INT IDAP preciation){ this.idap preciation = IDAP preciation; } 公共字符串getZone(){ 返回区; } 公共无效setZone(字符串区){ this.zone =区; } 公共字符串getRep1(){ 返回REP1; } 公共无效setRep1(字符串REP1){ this.rep1 = REP1; } 公共字符串getRep2(){ 返回REP2; } 公共无效setRep2(字符串REP2){ this.rep2 = REP2; } 公共字符串getRep3(){ 返回rep3; } 公共无效setRep3(字符串rep3){ this.rep3 = rep3; } 公共字符串getRep4(){ 返回rep4; } 公共无效setRep4(字符串rep4){ this.rep4 = rep4; } 公共字符串getRep5(){ 返回rep5; } 公共无效setRep5(字符串rep5){ this.rep5 = rep5; } 公共双getLatitude(){ 返回纬度; } 公共无效setLatitude(双纬){ this.latitude =纬度; } 公共双getLongitude(){ 返回经度; } 公共无效setLongitude(双经度){ this.longitude =经度; } }和finnaly这里是logcat的错误我得到的时候我的午餐项目
6月7日至30日:33:14.220:E / AndroidRuntime(656):未捕获的处理程序:螺纹主力退出,由于未捕获的异常 6月七号至30日:33:14.300:E / AndroidRuntime(656):java.lang.RuntimeException的:无法启动的活动ComponentInfo {com.stage.sondage / com.stage.sondage.Questionnaire}:显示java.lang.NullPointerException 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread.access $ 2200(ActivityThread.java:119) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1863) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.os.Handler.dispatchMessage(Handler.java:99) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.os.Looper.loop(Looper.java:123) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread.main(ActivityThread.java:4363) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在java.lang.reflect.Method.invokeNative(本机方法) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在java.lang.reflect.Method.invoke(Method.java:521) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:860) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在dalvik.system.NativeStart.main(本机方法) 6月七号至30日:33:14.300:E / AndroidRuntime(656):由:显示java.lang.NullPointerException 6月七号至30日:33:14.300:E / AndroidRuntime(656):在com.stage.sondage.Questionnaire.onCreate(Questionnaire.java:54) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 6月七号至30日:33:14.300:E / AndroidRuntime(656):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 6月七号至30日:33:14.300:E / AndroidRuntime(656):11 ...更多
感谢ü的帮助
解决方案 看到你的日志后出现空指针异常在下面的类 **公共类问卷扩展活动** ..at线nuber 53或54 你可以看到该行类和debugg,看看哪些对象值 即将为空,并修复它i am trying to get the answers from a form in an application with android. here is the code i used :
package com.stage.sondage; import android.app.Activity; import android.content.Intent; import android.database.sqlite.SQLiteException; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; public class Questionnaire extends Activity { //Création d'une instance de ma classe SurveyAdapter SurveyAdapter survey=new SurveyAdapter(this); Appreciation appreciation=new Appreciation(); public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.questions); // We get a reference on the radio-group widget RadioGroup mRadioGroup1 = ( RadioGroup )findViewById( R.appreciation.rep1 ); RadioGroup mRadioGroup2 = ( RadioGroup )findViewById( R.appreciation.rep2 ); RadioGroup mRadioGroup3 = ( RadioGroup )findViewById( R.appreciation.rep3 ); RadioGroup mRadioGroup4 = ( RadioGroup )findViewById( R.appreciation.rep4 ); RadioGroup mRadioGroup5 = ( RadioGroup )findViewById( R.appreciation.rep5 ); RadioButton b1 = (RadioButton)findViewById(mRadioGroup1.getCheckedRadioButtonId()); appreciation.setRep1((String) b1.getText()); RadioButton b2 = (RadioButton)findViewById(mRadioGroup1.getCheckedRadioButtonId()); appreciation.setRep1((String) b2.getText()); RadioButton b3 = (RadioButton)findViewById(mRadioGroup1.getCheckedRadioButtonId()); appreciation.setRep1((String) b3.getText()); RadioButton b4 = (RadioButton)findViewById(mRadioGroup1.getCheckedRadioButtonId()); appreciation.setRep1((String) b4.getText()); RadioButton b5 = (RadioButton)findViewById(mRadioGroup1.getCheckedRadioButtonId()); appreciation.setRep1((String) b5.getText()); EditText zone = (EditText) findViewById(R.appreciation.zone); appreciation.setZone(zone.getText().toString()); appreciation.setLatitude(0); appreciation.setLongitude(0); OnClickListener ButtonEnregistrer = new OnClickListener(){ public void onClick(View actuelView) { //On ouvre la base de données pour écrire dedans survey.open(); //On insère le livre que l'on vient de créer survey.insertAppreciation(appreciation); //on ferme la base de données survey.close(); Intent intent = new Intent(Questionnaire.this,Questionnaire.class); startActivity(intent); } }; Button enregistrer = ( Button )findViewById( R.appreciation.enregistrer); enregistrer.setOnClickListener(ButtonEnregistrer); } }here is the code of the survey adapter class :
package com.stage.sondage; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; public class SurveyAdapter { //nom de la table public static final String APPRECIATION_TABLE_NAME = "Appreciation"; public static final String COLUMN_IDAPPRECIATION = "IDAPPRECIATIONL"; public static final int NUM_COLUMN_IDAPPRECIATION = 0; public static final String COLUMN_ZONE = "ZONE"; public static final int NUM_COLUMN_ZONE = 1; public static final String COLUMN_LATITUDE = "LATITUDE"; public static final int NUM_COLUMN_LATITUDE = 2; public static final String COLUMN_LONGITUDE = "LONGITUDE"; public static final int NUM_COLUMN_LONGITUDE = 3; public static final String COLUMN_REP1 = "REP1"; public static final int NUM_COLUMN_REP1 = 4; public static final String COLUMN_REP2 = "REP2"; public static final int NUM_COLUMN_REP2 = 5; public static final String COLUMN_REP3= "REP3"; public static final int NUM_COLUMN_REP3 = 6; public static final String COLUMN_REP4= "REP4"; public static final int NUM_COLUMN_REP4 = 7; public static final String COLUMN_REP5= "REP5"; public static final int NUM_COLUMN_REP5 = 8; private SQLiteDatabase bdd; private AppreciationOpenHelper maBaseSQLite; public SurveyAdapter(Context context){ //On créer la BDD et sa table maBaseSQLite = new AppreciationOpenHelper(context, null); } public void open(){ //on ouvre la BDD en écriture bdd = maBaseSQLite.getWritableDatabase(); } public void close(){ //on ferme l'accès à la BDD bdd.close(); } public SQLiteDatabase getBDD(){ return bdd; } public long insertAppreciation(Appreciation app){ //Création d'un ContentValues (fonctionne comme une HashMap) ContentValues values = new ContentValues(); //on lui ajoute une valeur associé à une clé (qui est le nom de la colonne dans laquelle on veut mettre la valeur) values.put(COLUMN_ZONE, app.getZone()); values.put(COLUMN_LATITUDE, app.getLatitude()); values.put(COLUMN_LONGITUDE, app.getLongitude()); values.put(COLUMN_REP1, app.getRep1()); values.put(COLUMN_REP2, app.getRep2()); values.put(COLUMN_REP3, app.getRep3()); values.put(COLUMN_REP4, app.getRep4()); values.put(COLUMN_REP5, app.getRep5()); //on insère l'objet dans la BDD via le ContentValues return bdd.insert(APPRECIATION_TABLE_NAME, null, values); } }here is the code of the class ApprecationOpenHelper :
package com.stage.sondage; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteDatabase.CursorFactory; public class AppreciationOpenHelper extends SQLiteOpenHelper { //version de la base de données private static final int DATABASE_VERSION = 1; //le chemin de la base de donnée private static String DB_PATH = "/data/data/com.stage.sondage/databases/"; //nom de la base private static final String SURVEY_BASE_NAME="survey.db"; //nom de la table public static final String APPRECIATION_TABLE_NAME = "Appreciation"; // Description des colonnes public static final String COLUMN_IDAPPRECIATION = "IDAPPRECIATIONL"; public static final String COLUMN_ZONE = "ZONE"; public static final String COLUMN_LATITUDE = "LATITUDE"; public static final String COLUMN_LONGITUDE = "LONGITUDE"; public static final String COLUMN_REP1 = "REP1"; public static final String COLUMN_REP2 = "REP2"; public static final String COLUMN_REP3= "REP3"; public static final String COLUMN_REP4= "REP4"; public static final String COLUMN_REP5= "REP5"; // Requête SQL pour la création da la base private static final String REQUETE_CREATION_BDD = "CREATE TABLE "+ APPRECIATION_TABLE_NAME + " (" + COLUMN_IDAPPRECIATION + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_ZONE + " TEXT NOT NULL, " +COLUMN_LATITUDE + " DOUBLE NOT NULL, " +COLUMN_LONGITUDE + " DOUBLE NOT NULL, " + COLUMN_REP1 + " TEXT NOT NULL, " + COLUMN_REP2 + " TEXT NOT NULL,"+COLUMN_REP3 + " TEXT NOT NULL," +COLUMN_REP4+"TEXT NOT NULL,"+COLUMN_REP5 +" TEXT NOT NULL);"; public AppreciationOpenHelper(Context context, CursorFactory factory) { super(context, SURVEY_BASE_NAME, factory, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(REQUETE_CREATION_BDD); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub if (newVersion > DATABASE_VERSION) { db.execSQL("DROP TABLE " + APPRECIATION_TABLE_NAME + ";"); onCreate(db); } } }here is the class Appreciation : package com.stage.sondage;
public class Appreciation { private int idappreciation; private String zone; private double latitude; private double longitude; private String rep1; private String rep2; private String rep3; private String rep4; private String rep5; public Appreciation(String zone, double latitude, double longitude, String rep1, String rep2, String rep3,String rep4,String rep5){ this.zone=zone; this.latitude=latitude; this.longitude=longitude; this.rep1=rep1; this.rep2=rep2; this.rep3=rep3; this.rep4=rep4; this.rep5=rep5; } public Appreciation() { // TODO Auto-generated constructor stub } public int getIdappreciation() { return idappreciation; } public void setIdappreciation(int idappreciation) { this.idappreciation = idappreciation; } public String getZone() { return zone; } public void setZone(String zone) { this.zone = zone; } public String getRep1() { return rep1; } public void setRep1(String rep1) { this.rep1 = rep1; } public String getRep2() { return rep2; } public void setRep2(String rep2) { this.rep2 = rep2; } public String getRep3() { return rep3; } public void setRep3(String rep3) { this.rep3 = rep3; } public String getRep4() { return rep4; } public void setRep4(String rep4) { this.rep4 = rep4; } public String getRep5() { return rep5; } public void setRep5(String rep5) { this.rep5 = rep5; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } }and finnaly here is the logcat errors i get when i lunch the project
07-30 06:33:14.220: E/AndroidRuntime(656): Uncaught handler: thread main exiting due to uncaught exception 07-30 06:33:14.300: E/AndroidRuntime(656): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stage.sondage/com.stage.sondage.Questionnaire}: java.lang.NullPointerException 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.os.Handler.dispatchMessage(Handler.java:99) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.os.Looper.loop(Looper.java:123) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread.main(ActivityThread.java:4363) 07-30 06:33:14.300: E/AndroidRuntime(656): at java.lang.reflect.Method.invokeNative(Native Method) 07-30 06:33:14.300: E/AndroidRuntime(656): at java.lang.reflect.Method.invoke(Method.java:521) 07-30 06:33:14.300: E/AndroidRuntime(656): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 07-30 06:33:14.300: E/AndroidRuntime(656): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 07-30 06:33:14.300: E/AndroidRuntime(656): at dalvik.system.NativeStart.main(Native Method) 07-30 06:33:14.300: E/AndroidRuntime(656): Caused by: java.lang.NullPointerException 07-30 06:33:14.300: E/AndroidRuntime(656): at com.stage.sondage.Questionnaire.onCreate(Questionnaire.java:54) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-30 06:33:14.300: E/AndroidRuntime(656): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 07-30 06:33:14.300: E/AndroidRuntime(656): ... 11 morethank u for your help
解决方案 after seeing your log there is null pointer exception in below class **public class Questionnaire extends Activity** ..at line nuber 53 or 54 you may to see that line your class and debugg and see which object value coming as null and fix it
更多推荐
在SQLite数据库的错误插入数据
发布评论