I am building an app in Android studio that retrieve some data from firebase the code actually works alright but I notice a bug which if I switch to another activity while the data is still loading from firebase the app crashes I have written a toast message in the onCancelled
method but the message doesn't display instead the app just crashes.
How can I get something to display instead of the app crashing?
Asked
Active
Viewed 173 times
0

Vadim Kotov
- 8,084
- 8
- 48
- 62

Serenity Emmanuel
- 95
- 8
-
1Edit your question and add your error from logcat here. Nobody will be able to help you by your "it crashed help me". – Vedprakash Wagh Jun 26 '19 at 13:37
-
You could have a look at [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) for basic troubleshooting. First you'd need to determine what exactly crashes and where. Then you could edit the question and display any code relevant to the problem. – Markus Kauppinen Jun 26 '19 at 13:38
-
Hello sir, can you edit this question and add the logcat with the code that related to the errors? – Ticherhaz FreePalestine Jun 26 '19 at 13:45
-
If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question. Please also add the code that you are using and please also responde with @AlexMamo – Alex Mamo Jun 26 '19 at 16:32
-
Sorry for the late reply my emulator is not working so I am running the app on a real device so I don't have any log – Serenity Emmanuel Jul 03 '19 at 05:45