In my application , we are opening local pdf using below link: (Why isn't my app on the list of apps to open txt file?). Its work fine for first local pdf, but if i click home key of device application goes background and i tries to open file explorer it redirects to application and onResume method gets called which shows Pdfreader activity default. I tried finishTaskOnLaunch , clearTaskOnLaunch , launchMode as singleTask , singleTop. Please need help.
Asked
Active
Viewed 123 times
2 Answers
1
You cannot override the homekey. The Home button is made by android to provide a solution to the users to exit from malicious applications that could harm their devices.
As the accepted answer from this post said: Overriding the Home button - how do I get rid of the choice?
So try to do what you want in a different way
-
can you please explain your answer in detail? as per given above link i have made changed in manifest and in onResume of activity , i am checking intent.getAction = Intent.ACTION_VIEW .But i dont understand why onResume is getting called forecfully if i tries to open file explorer to pick up second pdf. Even i tried onNewIntent method to set new intent but its not working – Aarushi Dec 05 '13 at 11:04
0
close the file connection inside the onpause() method of your activity may fix your problem.
-
can you please explain your answer in detail? as per given above link i have made changed in manifest and in onResume of activity , i am checking intent.getAction = Intent.ACTION_VIEW .But i dont understand why onResume is getting called forecfully if i tries to open file explorer to pick up second pdf. Even i tried onNewIntent method to set new intent but its not working – Aarushi Dec 05 '13 at 11:01
-
because you currently open it as a part of your activity.use the activity flag FLAG_ACTIVITY_NEW_TASK – Dec 05 '13 at 11:15