Android Method to Enable/Disable Touch Screen - android

Hi there is thery any way to invoke a method that enables or disables the Touch Screen of Android?
I want this, because I have several buttons on my activity. When the user clicks on a button, it takes a few seconds to start the following activity, and because of that, while waiting that time, I don't want the user to be able to press anything.
I used a boolean that is True at start, then It changes to false when I click on the first button. And to every click on a button I check if the boolean is true...
But the problem is that Visually the user can click the button, it gets that look of being pressed..
So is there any good method that disables the entire touch screen ? And another that enables the entire touch screen ?
Thanks alot in advance ;)

But the problem is that Visually the user can click the button, it gets that look of being pressed
Disable the buttons, using setEnabled(false). This will not only prevent the user from clicking on them, but they will visually appear disabled, to let the user know that the user cannot click on them. It is important for the user to get the proper visual feedback about the buttons being disabled (and later enabled).
is thery any way to invoke a method that enables or disables the Touch Screen of Android?
Not really.

Related

How to disable Android touch

There are some application that disables all the touch inputs, including the touch events that occur on the navigation bar.
Examples are Touch Lock or UnTouch. How one can do that?
By analyzing the second linked app seems that there is a hidden layout that capture the touch events (like an empty onClickListener).
Initially I tried to draw a transparent foreground using the SYSTEM_ALERT_WINDOW permission and by assigning an empty touch listener. However in this way I cannot draw on the navigation bar, so the user can touch the home button and the back button.
Another way that I tried is to launch an Activity with transparent background and in fullscreen mode. In this way I can capture all the events. This works, but obviously this causes other activities to go in pause state.
So my question is, how can one reach the goal? Alternatively is possible to use some root/system commands?
Thanks!
Try this link. If you want to do it on just 1 view then edit out the iteration in the methods given.

Generic click event in Android

Recently I was able to create a tablet software for my Cerebral Palsy girl to "talk" to me, since she can't speak.
Well, a friend of mine has Amyothrophic Lateral Sclerosis (ALS). He can move just one finger and he is willing to use my daughter's software to be able to "talk" again.
Since he can move just a finger, I created a version where each item "blinks" (in yellow) for some time (just one second) and if he presses a mouse button, the item focused (in yellow) is activated.
See below:
It works if you leave the mouse over the black portion of the screen. If mouse is over the buttons, it won't work, it will click the button where the mouse is over.
Also, if he uses a keyboard and he presses the ENTER key, it will activate the first button, then, if he clicks the left arrow and then presses the ENTER again, it will activate the second button and so on.
So, I wish I could create an generic event that if he would press the ENTER key, just the selected (in yellow) item would be activated.
Any ideas?
Well you could make two different modes. One where there are click listeners for each picture,and another where simply a click anywhere on the screen is recognized ( ex. find the largest layout id and set a listener). Then in the second mode, use
http://developer.android.com/reference/android/view/KeyEvent.html
to detect KeyEvents such as Enter, and handle them depending on the highlighted View.

Pressing multiple buttons at the same time

I'm working on an app which presents users with four buttons and a timer. The users then tap as fast as they can, each user on his own button, and the one with the most taps at the end wins.
I can't use onClick here, because it locks up the UI thread until the button is released, effectively blocking other button presses. I have searched around for a bit and found that I could use onTouch, but it doesn't work the way I want it to. If a user has touched and is still holding a button, any subsequent touches on other buttons will behave as though this first button was pressed.
Someone suggested the use of an image, transparent and stretched across the entire visible UI. One could then read any touches on this imageview and assign a touch to a particular button based on the coordinates of the press. (I guess I would take a screenshot of my UI with the four buttons visible, open it in paint and write down the coordinates of the borders for each button, then use those coordinates in the code to figure out which button the user was trying to press.)
Can anyone help me with this method of work, give me a quick example, or link to where I can learn how to do it and implement it in my app? It would be much appreciated.
TL;DR: How to use an image, transparent and stretched across the entire visible UI and read the coordinates of each press (even if multiple at once)?

How to Intercept the keyguard(software menu) clicks for eg "Settings" menu option click?

Is there a way to find out when did a user click "Setting" options on the screen menu?
The onClick listner's KeyDown events catches only the hardware buttons on the phone and not the clicks of the sofware keyboard that shows up when a textbox/editText gets a focus and the key guard shows up.
Is it even possible using public android SDK.
P.S. : I am only concerned with 2.2 and 2.3 so its fine if this is not possible on 3.0 and above.
Thnx
EDIT
Explanation of a scenario that will help understand the question better!
I have a full screen activity with a editText and a button. I want to intercept all the clicks that a user make and based on that make some decisions.
I am able to register a listner to intercept what phisical keys are being clicked(HOME, MENU, VOLUME UP/DOWN etc)...The problem is, when the user clicks on the editText i.e. the text box gets the focus, the sotware keypad shows up. Now I also want to intercept what keys(numbers, alphabets, special characters or even custom functions on some samsung android phone like 'Go To Settings' are clicked and perform action based on the clicks.
My question is, is it possible and if yes, then how?
NOTE: Please dont ask me why am I doing this because its bad user experience. I am very much aware of that. I am trying to do this in a particular context that needs this functionality. Thnx!
You need to use the KeyListener class and setKeyListener
http://developer.android.com/reference/android/widget/TextView.html
This only allows you to modify/filter input into the TextView.

Button highlight behavior changed on Froyo?

On Android 2.1, just as on most graphical computer OSes, pressing the mouse while in a button, then dragging away, then dragging back, then releasing (while within the button rectangle) would result in a button press. It would also highlight while the mouse pointer was within (or actually near) the button, going off as the pointer left the zone, then back on when the pointer returned.
This behavior allows the user to cancel, mid-press, by dragging away from the button until its highlight is off and releasing; it also allows the user to change her mind about cancelling, so long as the mouse is still down, and go back into the button to "rescue" the click.
In 2.2, it appears that Android no longer allows a return to the button. Dragging away cancels the highlight, but returning with the mouse still held down does not re-highlight the button, nor does an away-and-return click generate a click event.
So, my questions: Is this change real (has anyone else seen it)? and: Is it intentional? What is the rationale for this change, if it is intentional?
Since I tested in an Android 4.0.4, I can guess this was intentional.
My guess is that they made the change to prevent some problems with people who are not used to touchable screens. It can also be to improve usability for people with disabilities. However, I'm not Google nor know the real reason of the change. Those were just my guesses.

Categories

Resources