Is it possible to get control of the android image gallery from within my app? I am able to open the gallery and the image below, but however, whenever I click the back button, it returns me straight to my app, but I want the back button to go back to the gallery first then back to my app so that the user have to click the back button twice to go back to my app
My code is below:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("content://media/external/images/media"), "image/*");
startActivityForResult(intent, 0);
However with reference to the code below, I am able to allow user to go back to the gallery first then back to my app upon clicking the back button twice, but I am unable to allow user to open and view the image, meaning, once I click to launch the image, it straight away goes back to my app.
Code:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 0);
Any help would be greatly appreciated! Thanks in advance! 🙂
to start changing the ‘Back’ button, behavior,
you need to override the onKeyDown() method and than check if the desired button has been pressed:
//Override the onKeyDown method
this code overrides the OnKeyDown() method, that is called every time a key is pressed. The if statement inside this method checks if the ‘Back’ button has been pressed.
If it does, the code inside the block will execute.
you can use your own activity and event into function .
want more use Back Button Behaviour
let me know if you want any more help!!!