Through DispatchGesture, I need to somehow click on the back button, but do it programmatically, without clicking on the button or reproduce finish(), only in another app
I found a code that only clicks on the given coordinates
Thanks in advance:)
UPDATE
I found this: Trigger back-button functionality on button click in Android, but I want to make a click from Service
Related
Suppose I move to another activity from my current one and then I need to go back to previous activity by pressing the back button originally present in the phone along with a home button and menu button. I have disabled my Action Bar and I don't want to enable it. Nor I want to create an icon in my activity that represents back.
Please Help!
to initiate the back operation you can call
super.onBackPressed();
from your activity.
I'm working on an Android project in Java and I'd like to get the MotionEvent when the user hits the back button (onBackPressed).
I know how to override the back button press, and i know how to get the touch event from touches in my activity, but I couldn't find a way to get the touch event details out of the back button press.
The goal is to write the user's touch event details (as if the user touches a regular view) to a file, even when the back button is pressed.
Is it possible? if so, how can I do it?
My users require an alert in order to avoid leaving accidentally my app when clicking on Home button (otherwise, they loose their -long- work and have to restart it... Indeed, my AR app cannot recover its state at restart).
So, I want to display an alert asking if they really want to leave if they click on the home button.
I saw some posts explaining how to override the Home button in order to catch the click event.
Namely this one: Detect home button press in android (use of 'HomeWatcher' or of 'onUserLeaveHint()')
Ok great, I catch the click event but as far as I can see, the app is left anyway and the user is sent to the home screen (springboard).
Is there any way to to what I want:
catch the click event on Home button
display an alert
go home only if the users confirms that he wants to leave
No, for security reasons, there is no way of blocking the default behavior of home button.
I am working on a small task for an android app. And I dont really know what are the things I need to do or things I should be careful for.
In a user's personal page, there is a button where the user can click in. Then it goes to a layout where there are two buttons "cancel" and "submit". Below them, there is a blank space where the user can edit his personal info. (Here the keyboard should automatically pop up).
After he clicks "submit", the info is saved and the app goes back to the personal page and the info he just entered will be displayed.
If a user already has some text for his info, after he clicks the edit button, the whitebox in the layout should has the info that he has previously entered. from that he can re-edit and submit again.
Any type of hints and guidelines will be greatly appreciated!! Thank you so much!!!
This sounds like a good place to use Activity results. You can make the screen where the user enters the information an Activity, and then start it by calling Activity.startActivityForResult(). Once the user is finished and clicks done, you store the result with Activity.setResult() and call finish() to close that activity. The original Activity that opened that screen will then get a callback in onActivityResult() with the data that you set in setResult(). This is a pretty common task so there should be plenty of examples around.
I have this app that originally has you take a picture, shows you a progress bar, and uploads it to a website.
What I want to add is something so that before the progress bar shows, an Intent starts an activity that loads a layout with a dropdown menu that allows you to choose a descriptor for the picture. Following this, once you hit the 'OK' button on this new layout, the program should return back to where it had left off and display the progress bar.
Does anyone have any ideas on how to achieve this?
It seems that all I really want is some way to tell the program to stall for a while to call an intent, and when the user hits 'OK', the code may resume.
You should be using OnActivityResult().. More information on the link below http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)