0

AnimationUtils.loadAnimation を使用して、アニメーション xml に基づいてイメージビューを移動するアプリを構築しています。アプリには 2 つのアクティビティがあります。最初の (MainActivity) は、アニメーションを読み込んで通常どおり再生します。2 番目のアクティビティは SurfaceHolder.Callback を実装し、アニメーションを読み込もうとするとクラッシュします。コードは次のとおりです(onCreate内):

ImageView sonar_line = (ImageView) findViewById(R.id.sonar_line);
animation2 = AnimationUtils.loadAnimation(this, R.anim.radar_line_slow);

sonar.setOnClickListener(new OnClickListener(){

    public void onClick(View v){
                if(sonar_line==null){
                    sonar_line = (ImageView) findViewById(R.id.sonar_line);
                }
                sonar_line.startAnimation(animation2);
    });

問題は SurfaceHolder.Callback でしょうか? 助けてください。

logcat は次のとおりです。

08-16 12:30:55.280: I/Choreographer(907): Skipped 31 frames!  The application may be doing too much work on its main thread.
08-16 12:30:56.742: I/Choreographer(907): Skipped 50 frames!  The application may be doing too much work on its main thread.
08-16 12:30:57.690: I/Ads(907): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/gma?preqs=1&session_id=4668883432257618371&seq_num=2&u_w=598&msid=com.mreprogramming.ultimateentitydetector&cap=m%2Ca&js=afma-sdk-a-v6.4.1&bas_off=0&imbf=8008&net=ed&app_name=1.android.com.mreprogramming.ultimateentitydetector&hl=en&gnt=3&carrier=310260&u_audio=4&kw&u_sd=2&ms=d_7Bq5TdKAYUPAq5seYPrZArBEIpPihNvTTeNQDAEv8YyBIlIZh5YbQplCb16O6hO40chh2qUW8t1tJdM_Y0-Ari8v_1TdDZzaXn22PCXxjuzmIP85qR7clhmZsisJR90_zD7qFPxhxLvzLSgoki41A0OkB2v8uWb0XTkcbhZH5G-qXseDQAgb99cPtkGZcABevehjoN1pbbr_NBnh_lnb5x7y9gSyca3Vd0Ic6TFh3LC3ot8eLIaxZqfKPJDXDPyJhADKAMGOYIZvnIQagFp6chf8g2RKzuOcDCxbsOLmA4ePyVJiIPsaSzTN6K63Z9mJ_sgbSWeOGM7mzUsafwCg&format=320x50_mb&oar=0&u_h=360&bas_on=0&ptime=52008&u_so=l&output=html&region=mobile_app&u_tz=0&client_sdk=1&ex=1&slotname=a1520cd4827f988&kw_type=broad&askip=1&gsb=3g&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_sdkAdmobApiForAds_di&eisu=uwwmiYREuXHN4MUb9Hax3DDGURdO_nWguot6OCV-e2efBzDgOa3ojiKuUNuWJUlJvB88tkDZKxo7-1zOQhLTfDNGDzto9vFYrbSFJtUdAOvefYgfHc5tm0oEhvilr9TB&et=360&jsv=53" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
08-16 12:30:57.711: I/Ads(907): Request scenario: Online server request.
08-16 12:31:00.770: I/Choreographer(907): Skipped 54 frames!  The application may be doing too much work on its main thread.
08-16 12:31:02.990: I/Choreographer(907): Skipped 34 frames!  The application may be doing too much work on its main thread.
08-16 12:31:04.502: D/dalvikvm(907): GC_FOR_ALLOC freed 5441K, 14% free 36967K/42904K, paused 136ms, total 180ms
08-16 12:31:04.601: I/dalvikvm-heap(907): Grow heap (frag case) to 40.028MB for 4000016-byte allocation
08-16 12:31:05.081: D/dalvikvm(907): GC_CONCURRENT freed 84K, 5% free 40789K/42904K, paused 148ms+50ms, total 479ms
08-16 12:31:05.081: D/dalvikvm(907): WAIT_FOR_CONCURRENT_GC blocked 279ms
08-16 12:31:05.521: D/dalvikvm(907): GC_FOR_ALLOC freed 977K, 7% free 40144K/42904K, paused 138ms, total 139ms
08-16 12:31:05.521: I/dalvikvm-heap(907): Grow heap (frag case) to 40.355MB for 1089936-byte allocation
08-16 12:31:05.761: D/dalvikvm(907): GC_FOR_ALLOC freed <1K, 7% free 41208K/43972K, paused 131ms, total 132ms
08-16 12:31:05.792: D/AndroidRuntime(907): Shutting down VM
08-16 12:31:05.831: W/dalvikvm(907): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
08-16 12:31:05.931: E/AndroidRuntime(907): FATAL EXCEPTION: main
08-16 12:31:05.931: E/AndroidRuntime(907): java.lang.NullPointerException
08-16 12:31:05.931: E/AndroidRuntime(907):  at com.mreprogramming.ultimateentitydetector.Cam_View$4.onClick(Cam_View.java:198)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.view.View.performClick(View.java:4204)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.view.View$PerformClick.run(View.java:17355)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.os.Handler.handleCallback(Handler.java:725)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.os.Handler.dispatchMessage(Handler.java:92)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.os.Looper.loop(Looper.java:137)
08-16 12:31:05.931: E/AndroidRuntime(907):  at android.app.ActivityThread.main(ActivityThread.java:5041)
08-16 12:31:05.931: E/AndroidRuntime(907):  at java.lang.reflect.Method.invokeNative(Native Method)
08-16 12:31:05.931: E/AndroidRuntime(907):  at java.lang.reflect.Method.invoke(Method.java:511)
08-16 12:31:05.931: E/AndroidRuntime(907):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-16 12:31:05.931: E/AndroidRuntime(907):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-16 12:31:05.931: E/AndroidRuntime(907):  at dalvik.system.NativeStart.main(Native Method)
4

0 に答える 0