Reputation: 728
A user of my app (Xperia Z1 Compact, Android 5.1) is experiencing a crash in my app when he is setting it up. Here's the workflow:
LaunchActivity is the Launch intent (noHistory=true, singleTask). It checks whether this is the app's first start or not. It is the first start, so it fires up BootActivity (noHistory=true, singleTask). BootActivity shows an animation of 3 seconds and opens up AddGoogleNewsActivity then (singleTask). This is the code that opens up AddGoogleNewsActivity:
in onCreate:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
endSplash();
}
}, 3000);
private void endSplash() {
YoYo.with(Techniques.FadeOut)
.duration(1000)
.interpolate(new AccelerateDecelerateInterpolator())
.withListener(new com.nineoldandroids.animation.Animator.AnimatorListener() {
@Override
public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {
}
@Override
public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
}
@Override
public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {
}
@Override
public void onAnimationRepeat(com.nineoldandroids.animation.Animator animation) {
}
})
.playOn(logo);
YoYo.with(Techniques.FadeOut)
.duration(1000)
.interpolate(new AccelerateDecelerateInterpolator())
.playOn(title2_txt);
YoYo.with(Techniques.FadeOut)
.duration(1000)
.interpolate(new AccelerateDecelerateInterpolator())
.playOn(title_txt);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (intent.equals("start")) {
startActivity(new Intent(BootActivity.this, AddGoogleNewsActivity.class));
} else if (intent.equals("complete")) {
Intent goToBoot = new Intent(BootActivity.this, HomeActivity.class);
goToBoot.putExtra("intent", "setupdone");
startActivity(goToBoot);
}
}
}, 1000);
}
In AddGoogleNewsActivity, the app gets an ANR: ANR Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
Does somebody know how I could fix this?
Many thanks!
Upvotes: 4
Views: 14943
Reputation: 1
I encountered the same problem. I increased the delay time from 1000 millis to 2000millis to start new activity. After that, this ANR was disappeared.
Upvotes: 0
Reputation: 728
EDIT from 30th May 2017: The REAL solution was that those devices did not have Text to Speech services available and that I needed to disable the access to it at all to stop those crashes.
Upvotes: 1
Reputation: 11
I have the same problem and it's only happen in some time,not all the time.
I think if Activity A jump to Activity B in oncreate method,it will maybe happen.But I have no proof.
Upvotes: 0