OnResume Activity 抛出错误,源查找失败
所以 super 来自 MingleActivity,它扩展了 Activity。它不断在 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();
}
}
So the super comes from MingleActivity, which extends Activity.It keeps throwing an error at ActivityThread.performResumeActivity(IBinder, boolean). My Try/Catch simply throws a Java.lang.Nullpointerexception error, so not really getting a lot of help there. It just keeps asking me to edit the source path.
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();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MingleActivity
中看到onResume()
吗?Exception
时,为什么要将startAnimating()
的调用包装在 try/catch 块中?onResume()
inMingleActivity
?startAnimating()
in a try/catch block when the method throws noException
?