所以super来自MingleActivity,它扩展了Activity.It不断在ActivityThread.performResumeActivity(IBinder,boolean)上抛出错误。我的Try / Catch只是抛出一个Java.lang.Nullpointerexception错误,所以并没有真正得到很多帮助。它一直要求我编辑源路径。
package mingle.mix;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.TextView;
import android.widget.Toast;
public class MingleSpalshActivity extends MingleActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.spalsh);
try
{
startAnimating();
}
catch (Exception e)
{
// this is the line of code that sends a real error message to the log
Log.e("ERROR", "ERROR IN CODE: " + e.toString());
// this is the line that prints out the location in
// the code where the error occurred.
e.printStackTrace();
}
}
private void startAnimating() {
// Fade in top title
TextView logo1 = (TextView) findViewById(R.id.title_text);
Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
logo1.startAnimation(fade1);
// Transition to Main Menu when bottom title finishes animating
fade1.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
// The animation has ended, transition to the Main Menu screen
startActivity(new Intent(MingleSpalshActivity.this, MingleGameActivity.class));
MingleSpalshActivity.this.finish();
//Toast toast = Toast.makeText(getApplicationContext(), "A TOAST", Toast.LENGTH_SHORT );
//toast.show();
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
}
});
}
@Override
protected void onPause() {
super.onPause();
// Stop the animation
TextView logo1 = (TextView) findViewById(R.id.title_text);
logo1.clearAnimation();
}
@Override
protected void onResume()
{
super.onResume();
// Start animating at the beginning so we get the full splash screen experience
startAnimating();
}
}
答案 0 :(得分:0)
onResume()
中看到MingleActivity
吗?startAnimating()
时,为什么要在try / catch块中包含对Exception
的调用?