Home > Mobile >  AndroidRuntime (625) : FATAL EXCEPTION: the main
AndroidRuntime (625) : FATAL EXCEPTION: the main

Time:10-01

10-09 15:33:02. 030: E/AndroidRuntime (625) : FATAL EXCEPTION: main10-09 15:33:02. 030: E/AndroidRuntime (625) : Java. Lang. RuntimeException: Unable to instantiate the activity ComponentInfo {org. Dict. Db/org. Dict. Db. MyDatabaseHelper} : Java. Lang. InstantiationException: can 't instantiate the class org. Dict. Db. MyDatabaseHelper; no empty constructor10-09 15:33:02.030: E/AndroidRuntime(625): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)10-09 15:33:02.030: E/AndroidRuntime(625): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)10-09 15:33:02.030: E/AndroidRuntime(625): at android.app.ActivityThread.access$600(ActivityThread.java:123)10-09 15:33:02.030: E/AndroidRuntime(625): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)10-09 15:33:02.030: E/AndroidRuntime(625): at android.os.Handler.dispatchMessage(Handler.java:99)10-09 15:33:02.030: E/AndroidRuntime(625): at android.os.Looper.loop(Looper.java:137)10-09 15:33:02.030: E/AndroidRuntime(625): at android.app.ActivityThread.main(ActivityThread.java:4424)10-09 15:33:02.030: E/AndroidRuntime(625): at java.lang.reflect.Method.invokeNative(Native Method)10-09 15:33:02.030: E/AndroidRuntime(625): at java.lang.reflect.Method.invoke(Method.java:511)10-09 15:33:02.030: E/AndroidRuntime(625): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)10-09 15:33:02.030: E/AndroidRuntime(625): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)10-09 15:33:02.030: E/AndroidRuntime(625): at dalvik.system.NativeStart.main(Native Method)10-09 15:33:02.030: E/AndroidRuntime(625): Caused by: java.lang.InstantiationException: can't instantiate class org.dict.db.MyDatabaseHelper; No empty constructor10-09 15:33:02. 030: E/AndroidRuntime (625) : at the Java. Lang. Class. NewInstanceImpl (Native Method) 10-09 15:33:02. 030: E/AndroidRuntime (625) : at the Java. Lang. Class. NewInstance (1319) Class. Java: 10-09 15:33:02. 030: E/AndroidRuntime (625) : an android. The app. Instrumentation. NewActivity (1023) Instrumentation. Java: 10-09 15:33:02. 030: E/AndroidRuntime (625) : an android. The app. ActivityThread. PerformLaunchActivity (1871) ActivityThread. Java: 10-09 15:33:02. 030: E/AndroidRuntime (625) :... 11 more for bosses to help look at this is what happened, the development of the running of the android appear problem,

CodePudding user response:

Can 't instantiate the class org. Dict. Db. MyDatabaseHelper
No empty constructor10-09 15:33:02. 030: E/AndroidRuntime (625) :

You instantiate MyDatabaseHelper this mistake that there is no empty constructor look at your code

CodePudding user response:

reference 1st floor usecf response:
can 't instantiate the class org. Dict. Db. MyDatabaseHelper
No empty constructor10-09 15:33:02. 030: E/AndroidRuntime (625) :

You instantiate MyDatabaseHelper this mistake this no empty constructor look at your code

Package org. Dict. Db. The import android. The content. The Context; The import android. Database. Sqlite. SQLiteDatabase; The import android. Database. Sqlite. SQLiteOpenHelper; The import org. Dict. Db. R; Public class MyDatabaseHelper extends SQLiteOpenHelper {final String CREATE_TABLE_SQL="create table dict (_id integer primary key autoincrement, word, detail)";/* * * @ param context * @ param name * @ param version */protected MyDatabaseHelper (context context, String name, int version) {super (context, name, null, version); } @ Override public void onCreate (SQLiteDatabase db) {db. ExecSQL (CREATE_TABLE_SQL); } @ Override public void onUpgrade (SQLiteDatabase db, int oldVersion, int newVersion) {System. Out. Println (" -- -- -- -- -- -- -- -- onUpdate Called -- -- -- -- -- -- -- -- "+ oldVersion +" -- -- -- & gt;" + newVersion); }}

CodePudding user response:

The import android. The content. The Context;
The import android. Database. Sqlite. SQLiteDatabase;
The import android. Database. Sqlite. SQLiteOpenHelper;
The import org. Dict. Db. R;

@ SuppressWarnings (" unused ")
Public class MyDatabaseHelper extends SQLiteOpenHelper {
Final String CREATE_TABLE_SQL=
"Create table dict (_id integer primary key autoincrement, word, detail)";
/* *
* @ param context
* @ param name
* @ param version
*/
Protected MyDatabaseHelper (Context Context, String name, int version)
{
Super (context, name, null, version);
}

@ Override
Public void onCreate (SQLiteDatabase db)
{
Db. ExecSQL (CREATE_TABLE_SQL);
}

@ Override
Public void onUpgrade (SQLiteDatabase db, int oldVersion, int newVersion) {
System. Out.println (" -- -- -- -- -- -- -- -- onUpdate Called -- -- -- -- -- -- -- -- "
+ oldVersion + "-- - & gt;" + newVersion);
}

}

CodePudding user response:

Your MyDatabaseHelper is Activity, but the name of the flower in the flowery,
The Activity are not allowed to have a constructor, so your SQLiteOpenHelper encapsulation away inherit appcompatActivity line directly

CodePudding user response:

Is the public class in a

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnull
  • Related