0

こんにちは、新しい Android 開発者です。viewFlipper に画像を表示したいのですが、機能していません。LogCat テキストは次のとおりです。

09-21 13:27:37.950: W/dalvikvm(5746): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
09-21 13:27:37.970: E/AndroidRuntime(5746): FATAL EXCEPTION: main
09-21 13:27:37.970: E/AndroidRuntime(5746): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.iplayer/com.android.iplayer.play}: java.lang.NullPointerException
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.os.Looper.loop(Looper.java:123)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at dalvik.system.NativeStart.main(Native Method)
09-21 13:27:37.970: E/AndroidRuntime(5746): Caused by: java.lang.NullPointerException
09-21 13:27:37.970: E/AndroidRuntime(5746):     at com.android.iplayer.play.matchStringMethod(play.java:92)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at com.android.iplayer.play.onCreate(play.java:43)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-21 13:27:37.970: E/AndroidRuntime(5746):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-21 13:27:37.970: E/AndroidRuntime(5746):     ... 11 more
09-21 13:27:37.980: W/ActivityManager(59):   Force finishing activity 

ここに私のコードがあります:

flipper.setVisibility(View.VISIBLE);
Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.sample );
imageView = new ImageView(this);
imageView.setImageBitmap(bmp);
flipper.addView(imageView);
Thread timer = new Thread(){
    public void run(){
        try{
            sleep(3000);
        }catch(InterruptedException e){
            e.printStackTrace();
        }finally{
            currentSequenceIndex++;
            if(sequenceList.size() > currentSequenceIndex){
                matchStringMethod();
            }
        }
    }; timer.start();
}
4

1 に答える 1

0
13:27:37.970: E/AndroidRuntime(5746): Caused by: java.lang.NullPointerException 09-21 13:27:37.970: E/AndroidRuntime(5746): at com.android.iplayer.play.matchStringMethod(play.java:92) 09-21 

matchStringMethod()メソッド内の92 行目にヌル ポインター例外があります。

于 2012-09-21T02:15:06.477 に答える