[Q] Help with Activity life cycle - Android Software Development

Hey there,
I have a activity that i wish to be opened & closed as fast as possible. When i press the backbutton and then reopen the activity it opens instantly(what i want). BUT when i press the home button and they try and re open the activity it lags for 2-3 seconds. Even tho in my onPause im calling the onBackPresed() function...
any ideas how to fix this?

You could try putting "finish();" in the onPause() method, instead of calling the back button handler

Related

Is it possible to have a program always running

I use Calender SBHC a lot- its great. but everytime i try to get out of it, it closes. is it possible to force it to stay running in the background even if i press the X button in the top right.??
otherwise it takes time to load up each time
Don't close it with the cross, press only the ok the hardware ok button, it will minimize the app. And make the calendar in the taskmanager to an exclusive app, so it will not be automatically closed.
You can allso add it to the exception in the HTC task manager settings.
Start the program, go to settings, system tab, then Task Manager.
Long press on SBHC and click add exclusive .

[Q] Back Key behavior can be modified?

So i have a galaxy s4. i had a idea, about pausing the process when leaving an app when hittin back button instead of destroying it.
when we open any app , bbm, facebook. games, twitter por example. and when we go out from it by pressing continously the back key, when we try to open the app again it will take more time than if we tap the home button.
basically home button tells android to pause the process and backbutton to close it which require more time when reloading the same app again.
i beleave this is not a remmaping thing because the back button will still going steps back in the apps, so, when there is no more steps to go back then it will pause it (not close it) ; home button will remain the same, pausing all apps to go home screen. and back button will pause only the one we are on (instead of closing it)
i repeat a lot the same thing because i want to be very clear. dont take it bad please.
Is this possible to make? may any of you give me some advices to do it?

[Q] Ignoring apps in multitasking menu (holding home key)... is it possible?

Hi guys,
sometimes (2-3 times per day) I clean running apps by holding home key -> multitasking menu -> close all.
Please don't blame me for doing this or say that in android it's not necessary to clean memomory and so on...
Everything is fine when doing this, except that closing "dialer-contacts..." app, when I open it again it has some micro-lag when opening again. This is the only app I don't want to close. I could close all other apps except this, but it's not confortable as pressing a single button to close all.
So, my question is: is there a way to prevent that multitasking considers "dialer-contacts..." app in its history? so that I can close all app with a single button avoiding to close that app?

[Q] onPause() by home button pressed send intent - delay

Hi
I have two activitys and have following use case:
If user presses in the first activityOne the home button, onPause() is called. In onPause() I'd like to send an intent to the second activity to launch it.
Technically it works, but there is a huge delay betwend pressing the home button and launching the activity, about 4-6 seconds. If I send the intent by any other button pressed, it switches immediately.
Is it possible to speed up the switching or is this a given android behavior?
Regards,
cloooned
its a pretty bad level of coding to start an intent when onpause is called. consider just pressing the home button of your phone to exit the app leads you to some other activity instead.
also onpause will only be called when the activity goes to background. it will take a bit of time to reach that point.
Since the key event has been removed from the home button in Android 4.x, it seems to be one of the few chances to catch the home button pressed event. One other possibility is to overwrite the launcher with the activity and change the launcher default settings, but this would go to far.
Android prohibits you from starting an activity (from an intent) within 5 seconds after the user presses the home button. All startActivity intents will be delayed and executed after this 5 second interval. It is bad practice to start a new activity when the home button is pressed since the home button is the users last resort to escape an application.

Back button close the current application ? How i can change that ?(not force close)

I made a video so you can understand it better
So ... as you can see pressing the back button close the application or something like that and pressing the home button to leave it will result in a smooth animation when re-entering it
is there a way so i can change that ? i really like the way how application open when i leave them with the home button
I can't watch the video right now, but I will assume you are not talking about long-pressing the back button.
I guess that is just how applications work. Home button let's them run in the background and back button closes them.
The only way you can change it is with xposed or a custom rom.
Edit: Changin the behavior will also take away the ability to use it for what it was intended: to go back.
You can assing it another function or disable it altogether, but either way, you will lose the back function of the button and will have to use the app integrated back buttons.
prologikus said:
I made a video so you can understand it better
So ... as you can see pressing the back button close the application or something like that and pressing the home button to leave it will result in a smooth animation when re-entering it
is there a way so i can change that ? i really like the way how application open when i leave them with the home button
Click to expand...
Click to collapse
From another source:
Back Key :
If you press Back Key, onPause(), onStop() and onDestroy() callbacks will called.
Activity will created again by system calls onCreate() callback, then onStart() and onResume() callbacks will be followed.
Home Key :
If you press Home Key, onPause() and onStop() callbacks will called.
Here Activity will restart by system calls onRestart() callback, then onStart() and onResume() callbacks will be followed.
Click to expand...
Click to collapse
The back key will quit the application while the home key will let it run. That are the main differences. That's why they act differently. If you still want it, I know that CM based roms support changing of the layout.
but how ? or how i can search ... i only found that some layout are in generic.kl but here is just a simple match up, keys with functions idk ..
OR this is writed in the app code ?

Categories

Resources