我正在尝试将我的sqlite数据库导入android

时间:2016-04-16 17:44:43

标签: android sqlite

每次运行应用程序时,都会显示消息“遗憾的是应用程序已停止工作”。我不知道错误在哪里..如果有人可以帮助我,我会很高兴。

这是DatabaseHelper类:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream; 
import java.io.OutputStream;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {
private static String TAG = "DatabaseHelper";
private static String DB_PATH = "";
private static String DB_NAME ="database2.sqlite";
private SQLiteDatabase mDataBase;
private final Context mContext;

public DatabaseHelper(Context context)
{
    super(context, DB_NAME, null, 1);// 1? Its database Version
    if(android.os.Build.VERSION.SDK_INT >= 17){
        DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
    }
    else
    {
        DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
    }
    this.mContext = context;
}

public void createDataBase() throws IOException
{
    //If the database does not exist, copy it from the assets.

    boolean mDataBaseExist = checkDataBase();
    if(!mDataBaseExist)
    {
        this.getReadableDatabase();
        this.close();
        try
        {
            //Copy the database from assests
            copyDataBase();
            Log.e(TAG, "createDatabase database created");
        }
        catch (IOException mIOException)
        {
            throw new Error("ErrorCopyingDataBase");
        }
    }
}

//Check that the database exists here: /data/data/your package/databases/Da            Name
private boolean checkDataBase()
{
    File dbFile = new File(DB_PATH + DB_NAME);
    Log.v("dbFile", dbFile + "   "+ dbFile.exists());
    return dbFile.exists();
}

//Copy the database from assets
private void copyDataBase() throws IOException
{
    InputStream mInput = mContext.getAssets().open(DB_NAME);
    String outFileName = DB_PATH + DB_NAME;
    OutputStream mOutput = new FileOutputStream(outFileName);
    byte[] mBuffer = new byte[1024];
    int mLength;
    while ((mLength = mInput.read(mBuffer))>0)
    {
        mOutput.write(mBuffer, 0, mLength);
    }
    mOutput.flush();
    mOutput.close();
    mInput.close();
}

//Open the database, so we can query it
public boolean openDataBase() throws SQLException
{
    File dbFile = new File( DB_PATH);
    mDataBase = SQLiteDatabase.openOrCreateDatabase(dbFile, null);
    mDataBase = SQLiteDatabase.openDatabase(mPath, null,               SQLiteDatabase.NO_LOCALIZED_COLLATORS);
     return mDataBase != null;
}

@Override
public synchronized void close()
{
    if(mDataBase != null)
        mDataBase.close();
    super.close();
}

@Override
public void onCreate(SQLiteDatabase db) {

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}

} 这是DBAdapter类

 import java.io.IOException;
   import android.content.Context;
   import android.database.Cursor;
   import android.database.SQLException;
   import android.database.sqlite.SQLiteDatabase;
   import android.util.Log;
   public class DBAdapter
    {
    protected static final String TAG = "DBAdapter";

    private final Context mContext;
    private SQLiteDatabase mDb;
    private DatabaseHelper mDbHelper;

     public DBAdapter(Context context)
     {
        this.mContext = context;
        mDbHelper = new DatabaseHelper(mContext);
      }

     public DBAdapter createDatabase() throws SQLException
     {
        try
        {
            mDbHelper.createDataBase();
        }
        catch (IOException mIOException)
        {
            Log.e(TAG, mIOException.toString() + "  UnableToCreateDatabase");
            throw new Error("UnableToCreateDatabase");
        }
        return this;
    }

    public DBAdapter open() throws SQLException
    {
        try
        {
            mDbHelper.openDataBase();
            mDbHelper.close();
            mDb = mDbHelper.getReadableDatabase();
        }
        catch (SQLException mSQLException)
        {
            Log.e(TAG, "open >>"+ mSQLException.toString());
            throw mSQLException;
        }
        return this;
    }

    public void close()
    {
        mDbHelper.close();
    }

    public Cursor getTestData()
    {
        try
        {
            String sql ="SELECT * FROM IMAGES";

            Cursor mCur = mDb.rawQuery(sql, null);
            if (mCur!=null)
            {
                mCur.moveToNext();
            }
            return mCur;
        }
        catch (SQLException mSQLException)
        {
            Log.e(TAG, "getTestData >>"+ mSQLException.toString());
            throw mSQLException;
        }
    }

}

logcat

04-16 13:05:11.898: E/vinput-seamless(141): found seamless mouse device
04-16 13:05:16.550: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -N oem_nat_pre 
04-16 13:05:16.554: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -A PREROUTING -j oem_nat_pre 
04-16 13:05:16.566: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -N natctrl_nat_POSTROUTING 
04-16 13:05:16.570: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -A POSTROUTING -j natctrl_nat_POSTROUTING 
04-16 13:05:16.590: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -N st_nat_POSTROUTING 
04-16 13:05:16.590: E/Netd(146): exec() res=0, status=768 for /system/bin/iptables -t nat -A POSTROUTING -j st_nat_POSTROUTING 
04-16 13:05:16.702: E/setdpi(331): Setting DPI to 320
04-16 13:05:16.706: E/SurfaceFlinger(149): hwcomposer module not found
04-16 13:05:18.542: E/MonoPipe(152): Failed to fetch local time frequency when constructing a MonoPipe (res = -32).  getNextWriteTimestamp calls will be non-functional
04-16 13:05:19.762: E/memtrack(150): Couldn't load memtrack module (No such file or directory)
04-16 13:05:19.762: E/android.os.Debug(150): failed to load memtrack module: -2
04-16 13:05:22.854: E/EmojiFactory_jni(150): Failed to load libemoji.so: dlopen failed: library "libemoji.so" not found
04-16 13:05:33.606: E/ConsumerIrService(525): Can't open consumer IR HW Module, error: -2
04-16 13:05:33.606: E/libsuspend(525): Error opening /sys/power/autosleep: Permission denied
04-16 13:05:33.606: E/libsuspend(525): Error opening /sys/power/wakeup_count: Permission denied
04-16 13:05:33.606: E/libsuspend(525): failed to initialize autosuspend
04-16 13:05:33.766: E/EventHub(525): could not get driver version for /dev/input/mouse1, Not a typewriter
04-16 13:05:33.834: E/EventHub(525): could not get driver version for /dev/input/mouse0, Not a typewriter
04-16 13:05:33.942: E/EventHub(525): could not get driver version for /dev/input/mice, Not a typewriter
04-16 13:05:33.954: E/MobileDataStateTracker(525): default: Ignoring feature request because could not acquire PhoneService
04-16 13:05:33.954: E/MobileDataStateTracker(525): default: Could not enable APN type "default"
04-16 13:05:34.482: E/WifiStateMachine(525): Failed to reload STA firmware java.lang.IllegalArgumentException: command '1 softap fwreload eth1 STA' failed with '501 1 SoftAP command has failed'
04-16 13:05:34.582: A/SystemServer(525): BOOT FAILURE making Package Manager Service ready
04-16 13:05:34.582: A/SystemServer(525): java.lang.SecurityException: Unable to find app for caller android.app.ActivityThread$ApplicationThread@5292c5b8 (pid=525) when registering receiver android.app.LoadedApk$ReceiverDispatcher$InnerReceiver@5292c9cc
04-16 13:05:34.582: A/SystemServer(525):    at com.android.server.am.ActivityManagerService.registerReceiver(ActivityManagerService.java:13021)
04-16 13:05:34.582: A/SystemServer(525):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1458)
04-16 13:05:34.582: A/SystemServer(525):    at android.app.ContextImpl.registerReceiverAsUser(ContextImpl.java:1433)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:84)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.server.pm.UserManagerService.systemReady(UserManagerService.java:237)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:10602)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.server.ServerThread.initAndLoop(SystemServer.java:903)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.server.SystemServer.main(SystemServer.java:1189)
04-16 13:05:34.582: A/SystemServer(525):    at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:05:34.582: A/SystemServer(525):    at java.lang.reflect.Method.invoke(Method.java:515)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-16 13:05:34.582: A/SystemServer(525):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 13:05:34.582: A/SystemServer(525):    at dalvik.system.NativeStart.main(Native Method)
04-16 13:05:34.590: E/libsuspend(525): Error opening /sys/power/autosleep: Permission denied
04-16 13:05:34.590: E/libsuspend(525): Error opening /sys/power/wakeup_count: Permission denied
04-16 13:05:34.590: E/libsuspend(525): failed to initialize autosuspend
04-16 13:05:35.018: E/EGL_genymotion(525): egl: current context mark for deletion
04-16 13:05:35.154: E/WVMExtractor(152): Failed to open libwvm.so
04-16 13:05:35.594: E/LocationManagerService(525): no geocoder provider found
04-16 13:05:35.598: E/FlpHardwareProvider(525): Error hw_get_module 'flp': -2
04-16 13:05:35.598: E/FlpHardwareProvider(525): Error hw_get_module 'flp': -2
04-16 13:05:35.598: E/LocationManagerService(525): No FusedProvider found.
04-16 13:05:35.598: E/LocationManagerService(525): no geofence provider found
04-16 13:05:35.678: E/GpsLocationProvider(525): no AGPS interface in set_agps_server
04-16 13:05:35.846: E/BluetoothAdapter(582): Bluetooth binder is null
04-16 13:05:35.854: E/BluetoothAdapter(582): Bluetooth binder is null
04-16 13:05:35.866: E/BluetoothAdapter(582): Bluetooth binder is null
04-16 13:05:35.918: E/BluetoothAdapter(582): Bluetooth binder is null
04-16 13:05:35.998: E/GpsLocationProvider(525): no AGPS interface in set_agps_server
04-16 13:05:36.130: E/WifiConfigStore(525): Error parsing configurationjava.io.FileNotFoundException: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory)
04-16 13:05:36.130: E/wpa_supplicant(596): Line -1: too long model_name (len=40 max_len=32)
04-16 13:05:36.130: E/wpa_supplicant(596): Line -1: failed to parse 'model_name=Custom Phone - 4.4.4 - API 19 - 768x1280'.
04-16 13:05:36.130: E/WifiStateMachine(525): Failed to set model name Custom Phone - 4.4.4 - API 19 - 768x1280
04-16 13:05:36.130: E/wpa_supplicant(596): Line -1: too long model_number (len=40 max_len=32)
04-16 13:05:36.130: E/wpa_supplicant(596): Line -1: failed to parse 'model_number=Custom Phone - 4.4.4 - API 19 - 768x1280'.
04-16 13:05:36.130: E/WifiStateMachine(525): Failed to set model number Custom Phone - 4.4.4 - API 19 - 768x1280
04-16 13:05:36.138: E/WifiStateMachine(525): Failed to set country code US
04-16 13:05:36.138: E/WifiStateMachine(525): Failed to set frequency band 0
04-16 13:05:36.242: E/BluetoothAdapter(582): Bluetooth binder is null
04-16 13:05:36.354: E/BluetoothAdapter(701): Bluetooth binder is null
04-16 13:05:36.418: E/OpenGLRenderer(582): Getting MAX_TEXTURE_SIZE from GradienCache
04-16 13:05:36.422: E/OpenGLRenderer(582): MAX_TEXTURE_SIZE: 16384
04-16 13:05:36.442: E/OpenGLRenderer(582): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-16 13:05:36.442: E/OpenGLRenderer(582): MAX_TEXTURE_SIZE: 16384
04-16 13:05:36.838: E/BluetoothAdapter(674): Bluetooth binder is null
04-16 13:05:36.906: E/BluetoothAdapter(674): Bluetooth binder is null
04-16 13:05:36.918: E/BluetoothAdapter(674): Bluetooth binder is null
04-16 13:05:36.982: E/BluetoothAdapter(701): Bluetooth binder is null
04-16 13:05:37.302: E/BluetoothAdapter(701): Bluetooth binder is null
04-16 13:05:37.378: E/WifiStateMachine(525): Unexpected BatchedScanResults :null
04-16 13:05:38.098: E/gralloc_vbox86(149): gralloc_alloc: Mismatched usage flags: 768 x 1280, usage b33
04-16 13:05:38.098: E/(149): GraphicBufferAlloc::createGraphicBuffer(w=768, h=1280) failed (Invalid argument), handle=0x0
04-16 13:05:38.098: E/BufferQueue(149): [ScreenshotSurface] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
04-16 13:05:38.370: E/BluetoothAdapter(701): Bluetooth binder is null
04-16 13:05:38.842: E/ConnectivityService(525): Unexpected mtu value: android.net.wifi.WifiStateTracker@528f43ec
04-16 13:05:38.866: E/OpenGLRenderer(689): Getting MAX_TEXTURE_SIZE from GradienCache
04-16 13:05:38.870: E/OpenGLRenderer(689): MAX_TEXTURE_SIZE: 16384
04-16 13:05:38.890: E/OpenGLRenderer(689): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-16 13:05:38.910: E/OpenGLRenderer(689): MAX_TEXTURE_SIZE: 16384
04-16 13:05:38.922: E/ConnectivityService(525): Unexpected mtu value: android.net.wifi.WifiStateTracker@528f43ec
04-16 13:05:39.870: E/BluetoothAdapter(525): Bluetooth binder is null
04-16 13:05:39.870: E/BluetoothAdapter(525): Bluetooth binder is null
04-16 13:05:42.746: E/BluetoothAdapter(701): Bluetooth binder is null
04-16 13:06:54.297: E/memtrack(1279): Couldn't load memtrack module (No such file or directory)
04-16 13:06:54.301: E/android.os.Debug(1279): failed to load memtrack module: -2
04-16 13:06:56.821: E/memtrack(1339): Couldn't load memtrack module (No such file or directory)
04-16 13:06:56.821: E/android.os.Debug(1339): failed to load memtrack module: -2
04-16 13:06:57.817: E/OpenGLRenderer(1351): Getting MAX_TEXTURE_SIZE from GradienCache
04-16 13:06:57.821: E/OpenGLRenderer(1351): MAX_TEXTURE_SIZE: 16384
04-16 13:06:57.829: E/OpenGLRenderer(1351): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-16 13:06:57.829: E/OpenGLRenderer(1351): MAX_TEXTURE_SIZE: 16384
04-16 13:18:01.313: E/memtrack(1424): Couldn't load memtrack module (No such file or directory)
04-16 13:18:01.313: E/android.os.Debug(1424): failed to load memtrack module: -2
04-16 13:18:02.921: E/memtrack(1466): Couldn't load memtrack module (No such file or directory)
04-16 13:18:02.921: E/android.os.Debug(1466): failed to load memtrack module: -2
04-16 13:18:03.201: E/AndroidRuntime(1477): FATAL EXCEPTION: main
04-16 13:18:03.201: E/AndroidRuntime(1477): Process: com.example.asmaa_abdelaal.includedatabase, PID: 1477
04-16 13:18:03.201: E/AndroidRuntime(1477): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.asmaa_abdelaal.includedatabase/com.example.asmaa_abdelaal.includedatabase.MainActivity}: java.lang.NullPointerException
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.os.Looper.loop(Looper.java:136)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread.main(ActivityThread.java:5001)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at dalvik.system.NativeStart.main(Native Method)
04-16 13:18:03.201: E/AndroidRuntime(1477): Caused by: java.lang.NullPointerException
04-16 13:18:03.201: E/AndroidRuntime(1477):     at com.example.asmaa_abdelaal.includedatabase.DatabaseHelper.<init>(DatabaseHelper.java:30)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at com.example.asmaa_abdelaal.includedatabase.DBAdapter.<init>(DBAdapter.java:29)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at com.example.asmaa_abdelaal.includedatabase.MainActivity.onCreate(MainActivity.java:14)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 13:18:03.201: E/AndroidRuntime(1477):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
04-16 13:18:03.201: E/AndroidRuntime(1477):     ... 11 more
04-16 13:18:13.077: E/WindowManager(525): Starting window AppWindowToken{52a1f64c token=Token{52af3594 ActivityRecord{529154a8 u0 com.example.asmaa_abdelaal.includedatabase/.MainActivity t4}}} timed out
04-16 13:44:06.717: E/memtrack(1588): Couldn't load memtrack module (No such file or directory)
04-16 13:44:06.717: E/android.os.Debug(1588): failed to load memtrack module: -2
04-16 13:44:07.785: E/memtrack(1613): Couldn't load memtrack module (No such file or directory)
04-16 13:44:07.785: E/android.os.Debug(1613): failed to load memtrack module: -2
04-16 13:44:07.909: E/AndroidRuntime(1624): FATAL EXCEPTION: main
04-16 13:44:07.909: E/AndroidRuntime(1624): Process: com.example.asmaa_abdelaal.includedatabase, PID: 1624
04-16 13:44:07.909: E/AndroidRuntime(1624): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.asmaa_abdelaal.includedatabase/com.example.asmaa_abdelaal.includedatabase.MainActivity}: java.lang.NullPointerException
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.os.Looper.loop(Looper.java:136)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread.main(ActivityThread.java:5001)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at dalvik.system.NativeStart.main(Native Method)
04-16 13:44:07.909: E/AndroidRuntime(1624): Caused by: java.lang.NullPointerException
04-16 13:44:07.909: E/AndroidRuntime(1624):     at com.example.asmaa_abdelaal.includedatabase.DatabaseHelper.<init>(DatabaseHelper.java:27)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at com.example.asmaa_abdelaal.includedatabase.DBAdapter.<init>(DBAdapter.java:29)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at com.example.asmaa_abdelaal.includedatabase.MainActivity.onCreate(MainActivity.java:14)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 13:44:07.909: E/AndroidRuntime(1624):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
04-16 13:44:07.909: E/AndroidRuntime(1624):     ... 11 more
04-16 13:44:17.841: E/WindowManager(525): Starting window AppWindowToken{5297ee1c token=Token{529fc808 ActivityRecord{5297887c u0 com.example.asmaa_abdelaal.includedatabase/.MainActivity t5}}} timed out
04-16 13:55:45.049: E/memtrack(1693): Couldn't load memtrack module (No such file or directory)
04-16 13:55:45.049: E/android.os.Debug(1693): failed to load memtrack module: -2
04-16 13:55:46.857: E/memtrack(1718): Couldn't load memtrack module (No such file or directory)
04-16 13:55:46.857: E/android.os.Debug(1718): failed to load memtrack module: -2
04-16 13:55:47.125: E/AndroidRuntime(1728): FATAL EXCEPTION: main
04-16 13:55:47.125: E/AndroidRuntime(1728): Process: com.example.asmaa_abdelaal.includedatabase, PID: 1728
04-16 13:55:47.125: E/AndroidRuntime(1728): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.asmaa_abdelaal.includedatabase/com.example.asmaa_abdelaal.includedatabase.MainActivity}: java.lang.NullPointerException
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.os.Looper.loop(Looper.java:136)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread.main(ActivityThread.java:5001)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at dalvik.system.NativeStart.main(Native Method)
04-16 13:55:47.125: E/AndroidRuntime(1728): Caused by: java.lang.NullPointerException
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at com.example.asmaa_abdelaal.includedatabase.DatabaseHelper.createDataBase(DatabaseHelper.java:39)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at com.example.asmaa_abdelaal.includedatabase.DBAdapter.createDatabase(DBAdapter.java:36)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at com.example.asmaa_abdelaal.includedatabase.MainActivity.onCreate(MainActivity.java:15)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 13:55:47.125: E/AndroidRuntime(1728):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
04-16 13:55:47.125: E/AndroidRuntime(1728):     ... 11 more
04-16 13:55:56.925: E/WindowManager(525): Starting window AppWindowToken{52a1f64c token=Token{52a05584 ActivityRecord{5296a0e0 u0 com.example.asmaa_abdelaal.includedatabase/.MainActivity t6}}} timed out

0 个答案:

没有答案