58 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
107
views
How to perform critical operation on App termination (iOS: WillTerminate, Android:OnDestroy)
I'm working on a Xamarin Forms app that communicates with a hardware device over Bluetooth Low Energy (BLE).
If the app user decides to terminate the app by swiping up, I would like to notify the ...
-1
votes
1
answer
249
views
How to kill previous service before start new service in Java?
I am coding an Android app using Android Studio.
My service class takes the values from the main activity class when starting the service.
However, when I reassign the values in the main activity, the ...
0
votes
2
answers
451
views
Why is (and how to fix) my Android application triggering an onCreate (ON_CREATE) when removed from memory?
I manage an Android app for a client and am trying to detect when the app is removed from memory. I've noticed via logcat that when the app is removed from memory an ON_CREATE Lifecycle.Event is being ...
2
votes
1
answer
333
views
[Android]Error:"Can not perform this action after onSaveInstanceState" without using it
I'm a beginner with android and i have to create a simple app that handle a lessons book for students. Basically, sometimes i log out and crash with this error, sometimes not. I don't use se function &...
0
votes
1
answer
959
views
I call an API in the onDestroy() fragment method, but when I close the app it does not call
How do I call an API inside fragment using kotlin-coroutines before exiting the application?
In fact, I want it to be called before leaving the application.
0
votes
0
answers
88
views
how do I save score in onDestroy() android studio?
I tried to do this
@Override
protected void onDestroy() {
super.onDestroy();
SharedPreferences.Editor editor=this.getMyView().getSp().edit();
editor.putInt("score"...
0
votes
1
answer
86
views
How to update status in remote database if the activity's onDestroy() method is not called?
The goal is to update status in a remote database once the activity gets destroyed. The difficulty is that the activity's onDestroy() method call can be skipped if system kills the process. The ...
3
votes
1
answer
1k
views
Fragment leaking in ViewPager2 with FragmentStateAdapter on onDestroyView()
FYI: The question is short, but just in case I added more information at the end that may be relevant.
I needed an infinite scrolling ViewPager2, and I wanted to reuse a Fragment from the project as ...
0
votes
2
answers
5k
views
How to detect when application is closed by a user in android?
I know that, unlike onCreate(), Application class does not have a onDestroy() method. But I wanted to know when my application is closed (or it is not visible on screen anymore). After all, whatsapp ...
1
vote
1
answer
685
views
onCreate and onDestroy called after navigating away fragment
I noticed that in my Android app, after navigating away from a fragment, the onCreate() and onDestroy() methods are still called. This causes my code to throw an exception as the onDestroy() method ...
6
votes
3
answers
4k
views
Can Android kill the activity without killing the entire process while the app is in the background?
I'm wondering if Android system is able to kill the activity without the entire application process while the app is minimized. From Android documentation we know that onDestroy is only called when ...
0
votes
1
answer
157
views
How to completely destroy an activity from code?
I am building an medication reminder app in android using java. User can set one or more reminders and according to those will get notified to take the medicine.
Problem is, whenever a notification is ...
0
votes
0
answers
43
views
onDestroy() not called [duplicate]
I have a service that I start via and return START_REDELIVER_INTENT
public int onStartCommand(Intent intent, int flags, int startId) {
...
return START_REDELIVER_INTENT;
}
so it gets ...
0
votes
2
answers
56
views
On read shared preferences , only one object received
I'm trying to save some Array of objects to SharedPreferences.
How it's working on my app:
I have RecyclerView that contains clickable items. On click on these items, they are added to a new Array.
...
1
vote
1
answer
171
views
How to send result Intent using onPause (back button)
I have an Activity that contains a Recycler view and is called from the main activity with an extra string. The user would then do some things that would change the string and I would like to send it ...