Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Ikhane
2,390 PointsNavigate Up when findInBackground() is in progress crashes Ribbit
Hi,
I realized that when I don't have internet access or turn on airplane mode on the emulator, and I go back when the EditFriendsActivity is trying querying users from Parse.com the app crashes. with this error.
E/AndroidRuntime(2030): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@52a2e604 is not valid; is your activity running?
on this line of code;
dialog.show();
I suspect that its because that context from which the dialog was called no longer exists.
Please can someone tell me how to resolve this?
Thanks, Michael
2 Answers
Ben Jakuben
Treehouse TeacherThis is a bug! I didn't do anything about handling about handling when the network is unavailable or when the calls take a long time because we sort of covered that in the Blog Reader project, but I wish I had done something about this one. You can't make an AlertDialog persist across activities. So the solution would be to use a Toast or some other custom View instead of the AlertDialog. If you use a custom view, you need to add it to the WindowManager like this StackOverflow question: http://stackoverflow.com/a/20463727/475217
Michael Ikhane
2,390 PointsHi Ben,
I have been away from TH school because I haven't been feeling well.
I thought i heard you mention that the Parse library will take care of the network connectivity issues for us.
I followed the link you gave but it seems too complicated for my rookie skills. I guess I can get by, using a Toast.
Thanks