eclipse - Android: Issues transitioning to the next .java? -


i'm little confused... after animation, splash screen supposed start intent function operate next .java activity file... when runs after splash screen in emulator, wont work. opened logcat , said extent of java.lang.nullpointer , runtime exception running @ pause feature... can explain me? thanks.

package com.unicorn.test.whee;  import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.animation.animation; import android.view.animation.animation.animationlistener; import android.view.animation.animationutils; import android.widget.imageview;   public class splashscreenpear extends activity { imageview pearfade; /** called when activity first created. */  public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.pear); }  private void startanimating(){   animation pearfadeact = animationutils.loadanimation(this, r.anim.fadein);   imageview pearfade = (imageview) findviewbyid(r.id.pearish); pearfadeact.setanimationlistener(new animationlistener(){      public void onanimationend(animation animation) {         // animation has ended, transition main menu screen         startactivity(new intent(splashscreenpear.this, unicorn.class));         splashscreenpear.this.finish(); }          public void onanimationrepeat(animation animation) {         }          public void onanimationstart(animation animation) {         }     });  pearfade.startanimation(pearfadeact);  }   @override  protected void onpause() {      super.onpause();      pearfade.clearanimation();    }      @override      protected void onresume() {      super.onresume();      startanimating();      }     } 

logcat:

01-24 23:54:22.040: info/activitymanager(74): displayed com.unicorn.test.whee/.splashscreenpear: +2s317ms (total +2m20s769ms) 01-24 23:54:25.790: info/activitymanager(74): starting: intent { cmp=com.unicorn.test.whee/.unicorn } pid 579 01-24 23:54:25.790: debug/androidruntime(579): shutting down vm 01-24 23:54:25.790: warn/dalvikvm(579): threadid=1: thread exiting uncaught    exception (group=0x40015560) 01-24 23:54:25.790: error/androidruntime(579): fatal exception: main 01-24 23:54:25.790: error/androidruntime(579): java.lang.runtimeexception: unable pause activity {com.unicorn.test.whee/com.unicorn.test.whee.splashscreenpear}: java.lang.nullpointerexception 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.performpauseactivity(activitythread.java:2329) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.performpauseactivity(activitythread.java:2286) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.handlepauseactivity(activitythread.java:2266) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.access$1700(activitythread.java:117) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread$h.handlemessage(activitythread.java:935) 01-24 23:54:25.790: error/androidruntime(579):     @ android.os.handler.dispatchmessage(handler.java:99) 01-24 23:54:25.790: error/androidruntime(579):     @ android.os.looper.loop(looper.java:123) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.main(activitythread.java:3647) 01-24 23:54:25.790: error/androidruntime(579):     @ java.lang.reflect.method.invokenative(native method) 01-24 23:54:25.790: error/androidruntime(579):     @ java.lang.reflect.method.invoke(method.java:507)   01-24 23:54:25.790: error/androidruntime(579):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 01-24 23:54:25.790: error/androidruntime(579):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 01-24 23:54:25.790: error/androidruntime(579):     @ dalvik.system.nativestart.main(native method) 01-24 23:54:25.790: error/androidruntime(579): caused by: java.lang.nullpointerexception  01-24 23:54:25.790: error/androidruntime(579):     @ com.unicorn.test.whee.splashscreenpear.onpause(splashscreenpear.java:50)  01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activity.performpause(activity.java:3853)  01-24 23:54:25.790: error/androidruntime(579):     @ android.app.instrumentation.callactivityonpause(instrumentation.java:1190) 01-24 23:54:25.790: error/androidruntime(579):     @ android.app.activitythread.performpauseactivity(activitythread.java:2316) 01-24 23:54:25.790: error/androidruntime(579):     ... 12 more 01-24 23:54:26.339: warn/activitymanager(74): activity pause timeout historyrecord{4067cb18 com.unicorn.test.whee/.splashscreenpear}  01-24 23:54:28.169: info/process(579): sending signal. pid: 579 sig: 9 01-24 23:54:28.210: info/activitymanager(74): process com.unicorn.test.whee (pid 579) has died. 01-24 23:54:28.230: error/inputdispatcher(74): channel '405fa740 com.unicorn.test.whee/com.unicorn.test.whee.splashscreenpear (server)' ~ consumer closed input channel or error occurred.  events=0x8 01-24 23:54:28.230: error/inputdispatcher(74): channel '405fa740 com.unicorn.test.whee/com.unicorn.test.whee.splashscreenpear (server)' ~ channel unrecoverably broken , disposed! 

i think ur prob on line perfade.clearanimation(), remove frm onpause


edited: other way set declaration above oncreate imageview perfade;


and use in startanimating method:


 pearfade = (imageview) findviewbyid(r.id.pearish); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -