0

デバイスへのRSS更新を受信し、出力として表示する機能を持つアプリケーションを作成しました。問題は、ファイルの読み取りを開始するたびにアプリがクラッシュすることです。

ところで、ファイルはウェブサイトから来ています。

if (eventType == XmlPullParser.START_TAG)

この列になるとクラッシュします...誰か考えますか?

LogCatの出力は次のとおりです。

04-05 16:47:47.320: D/dalvikvm(352): GC_EXTERNAL_ALLOC freed 47K, 53% free 2547K/5379K, external 1957K/2137K, paused 144ms
04-05 16:47:47.917: D/dalvikvm(352): GC_EXTERNAL_ALLOC freed 1K, 53% free 2547K/5379K, external 2160K/2512K, paused 299ms
04-05 16:47:54.328: E/global(352): Deprecated Thread methods are not supported.
04-05 16:47:54.328: E/global(352): java.lang.UnsupportedOperationException
04-05 16:47:54.328: E/global(352):  at java.lang.VMThread.stop(VMThread.java:85)
04-05 16:47:54.328: E/global(352):  at java.lang.Thread.stop(Thread.java:1280)
04-05 16:47:54.328: E/global(352):  at java.lang.Thread.stop(Thread.java:1247)
04-05 16:47:54.328: E/global(352):  at dc.myappdsdasdadasda.app.___Startupseeds___$1.run(___Startupseeds___.java:54)
04-05 16:47:54.718: I/myappdsdasdadasda ListView loading..(352): ========================= [STARTER] ==========================
04-05 16:47:55.067: D/dalvikvm(352): GC_EXTERNAL_ALLOC freed 15K, 53% free 2567K/5379K, external 2736K/2946K, paused 207ms
04-05 16:47:55.479: I/myappdsdasdadasda ListView loading(352): URL ... {patch/xml}
04-05 16:47:55.497: I/myappdsdasdadasda ListView loading(352): Setting namespace.
04-05 16:47:55.497: I/myappdsdasdadasda ListView loading(352): xpp factory loaded
04-05 16:47:55.508: I/myappdsdasdadasda ListView loading(352): settingup utf-8 enccoding
04-05 16:47:57.389: I/myappdsdasdadasda ListView loading(352): AB AC AS HS[10] 001101 QTcheck #1
04-05 16:47:57.389: I/myappdsdasdadasda ListView loading(352): AB AC AS HS[10] 001101 QTcheck #2
04-05 16:47:57.389: I/myappdsdasdadasda ListView loading(352): AB AC AS HS[10] 001101 QTcheck #3
04-05 16:47:57.469: E/myappdsdasdadasda ListView loading..(352): Can't load screen layout, ERROR: java.lang.NullPointerException
04-05 16:47:57.469: I/myappdsdasdadasda ListView loaded(352): ========================= [FAILED!] ==========================
04-05 16:47:58.147: D/dalvikvm(352): GC_EXTERNAL_ALLOC freed 65K, 52% free 2599K/5379K, external 3221K/3471K, paused 68ms
04-05 16:47:58.329: D/dalvikvm(352): GC_EXTERNAL_ALLOC freed <1K, 52% free 2598K/5379K, external 4627K/5778K, paused 79ms

ヌルポインタ例外:

04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351): Can't load screen layout, ERROR: 
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351): java.lang.NullPointerException
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at dc.suUSDAKDAL.app._0xSession.onCreate(_0xSession.java:130)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.os.Handler.dispatchMessage(Handler.java:99)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.os.Looper.loop(Looper.java:123)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at android.app.ActivityThread.main(ActivityThread.java:3683)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at java.lang.reflect.Method.invokeNative(Native Method)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at java.lang.reflect.Method.invoke(Method.java:507)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-07 13:05:44.373: E/suUSDAKDAL ListView loading..(351):   at dalvik.system.NativeStart.main(Native Method)

OnCreate:

while (eventType != XmlPullParser.END_DOCUMENT)
{
    if (eventType == XmlPullParser.START_TAG)
    {
        if (xpp.getName().equalsIgnoreCase("item")) 
        {
            insideItem = true;
        } 
        else if (xpp.getName().equalsIgnoreCase("title")) 
        {
            if (insideItem)
                _viTitle[_0xFa] = xpp.nextText();
        }
        else if (xpp.getName().equalsIgnoreCase("description"))
        {
            if (insideItem)
                vi_subTitle[_0xFa] = xpp.nextText();
        }
        else if (xpp.getName().equalsIgnoreCase("link"))
        {
            if (insideItem)
                __Links[_0xFa] = xpp.nextText();
        }
    }
    else if(eventType==XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item"))
    {
        insideItem=false;
    }
    mStrings [_0xFa] = "http://images3.wikia.nocookie.net/__cb20111202150846/theamazingworldofgumball/images/c/c1/Banana_joe_on_the_floor,lol!.png";
    _0xFa ++;
}

新しいエラー:

04-13 09:48:53.999: E/AndroidRuntime(336): FATAL EXCEPTION: main
04-13 09:48:53.999: E/AndroidRuntime(336): java.lang.RuntimeException: Unable to start activity ComponentInfo{dc.sus.app/dc.sus.app._0xSession}: java.lang.ArrayIndexOutOfBoundsException
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.os.Looper.loop(Looper.java:123)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-13 09:48:53.999: E/AndroidRuntime(336):  at java.lang.reflect.Method.invokeNative(Native Method)
04-13 09:48:53.999: E/AndroidRuntime(336):  at java.lang.reflect.Method.invoke(Method.java:507)
04-13 09:48:53.999: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-13 09:48:53.999: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-13 09:48:53.999: E/AndroidRuntime(336):  at dalvik.system.NativeStart.main(Native Method)
04-13 09:48:53.999: E/AndroidRuntime(336): Caused by: java.lang.ArrayIndexOutOfBoundsException
04-13 09:48:53.999: E/AndroidRuntime(336):  at dc.sus.app._0xSession.onCreate(_0xSession.java:128)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-13 09:48:53.999: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-13 09:48:53.999: E/AndroidRuntime(336):  ... 11 more

新しいスタックトレース:

04-13 20:22:17.634: E/AndroidRuntime(527): FATAL EXCEPTION: main
04-13 20:22:17.634: E/AndroidRuntime(527): java.lang.OutOfMemoryError
04-13 20:22:17.634: E/AndroidRuntime(527):  at java.util.ArrayList.add(ArrayList.java:123)
04-13 20:22:17.634: E/AndroidRuntime(527):  at dc.sus.app._0xSession.onCreate(_0xSession.java:127)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.os.Looper.loop(Looper.java:123)
04-13 20:22:17.634: E/AndroidRuntime(527):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-13 20:22:17.634: E/AndroidRuntime(527):  at java.lang.reflect.Method.invokeNative(Native Method)
04-13 20:22:17.634: E/AndroidRuntime(527):  at java.lang.reflect.Method.invoke(Method.java:507)
04-13 20:22:17.634: E/AndroidRuntime(527):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-13 20:22:17.634: E/AndroidRuntime(527):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-13 20:22:17.634: E/AndroidRuntime(527):  at dalvik.system.NativeStart.main(Native Method)
4

1 に答える 1

0

コメント スレッドから回答への移行... コードが逆参照しようとすると、ヌル ポインター例外が発生しますmStrings[_0xFa]mStringssの配列だと思いStringます。どこでmStrings初期化されますか?

于 2012-04-10T13:44:16.840 に答える