0

Google Play デベロッパー コンソールで次のクラッシュ レポートを受け取りました。

java.lang.RuntimeException: Unable to start activity ComponentInfo{ZhuangDictActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
at android.app.ActivityThread.access$1500(ActivityThread.java:121)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:138)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at ZhuangDictActivity.showChooseDictDialog(ZhuangDictActivity.java:560)
at ZhuangDictActivity.onCreate(ZhuangDictActivity.java:339)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
... 11 more

これは onCreate の下にあります。

sharedPreferences = getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE);
            dictName = sharedPreferences.getString(PREFERENCES_DICT_NAME, null);
if (dictName == null) {
                showChooseDictDialog(false);
            } else {
                modifyDictVar(dictName);
                setTitle(loadDictInfo());

                initDbFile();
                databaseHelper.initDb();
            }

showChooseDictDialog:

private void showChooseDictDialog(boolean cancelable) {
        AlertDialog.Builder dictChooseBuilder = new AlertDialog.Builder(this);
        FilenameFilter filter = new FilenameFilter() {
            @Override
            public boolean accept(File dir, String filename) {
                return filename.contains(".ifo");
            }
        };
        dictFilenames = dictPathFile.list(filter);
        if (dictFilenames.length > 0) {
            dictChooseBuilder.setItems(dictFilenames, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dictName = dictFilenames[which].substring(0, dictFilenames[which].indexOf(".ifo"));

                    modifyDictVar(dictName);
                    initDbFile();
                    databaseHelper.initDb();

                    if (new File(ifoFileName).isFile()) {
                        setTitle(loadDictInfo());
                    }

                    if (new File(idxFileName).isFile() && dictFile.isFile()) {
                        sharedPreferences.edit().putString(ZhuangDictActivity.PREFERENCES_DICT_NAME, dictName).commit();

                        // dbHelper.dropTable(tableName);
                        if (!databaseHelper.isTableExist(tableName)) {
                            databaseHelper.beginTransaction();
                            databaseHelper.createTable(tableName);
                            for (char c = 'a'; c <= 'z'; c++) {
                                String temp = DatabaseHelper.transTableName(c);
                                databaseHelper.createTable(temp);
                            }
                            databaseHelper.setTransactionSuccessful();
                            databaseHelper.endTransaction();
                            new LoadDictIndexAsyncTask().execute(dictName);
                        }
                    } else {
                        showDialog(getResources().getString(R.string.choose_dict_content));
                    }
                }   
            });
            dictChooseBuilder.setCancelable(cancelable).setTitle(getResources().getString(R.string.choose_dict_title))
                    .create().show();
        } else {
            dictChooseBuilder.setCancelable(cancelable).setMessage(
                    getResources().getString(R.string.choose_dict_content)).create().show();
        }
    }

ZhuangDictAcitivity.java の完全なソース コードは、https ://code.google.com/p/zhuang-dict/source/browse/trunk/ZhuangDict/src/cn/wangdazhuang/zdict/ZhuangDictActivity.java から入手できます。

誰でもこれの解決策を知っていますか?

4

1 に答える 1