Android: soft keyboard efficient key press effect? - android

on softkeyboard, which one is better to give user a visual feedback during keypress:
1.redraw portion of button that was pressed to background canvas of main View to give pressed effect
2.each button has its own "pressed" View, and that View is set to visible (flashing) during keypress event (so no redraw needed but need more memory)
I know its trade-off between speed and memory usage, but I just want to know what you will do under this situation.

You wont be able to see the key because your finger will be covering it! The character being added to the focused text field might be enough.

Related

Prevent losing focus on EditText when clicking on a button in Android

I'm writing a custom EditText that will have functionalities to bold/italic/underline/lists .... for Android
It's working so far so good but I've a problem that when a user clicking on a Button (for styling bold/italic...), the user will lose focus on the EditText.
Anyone has any ideas how to prevent the button taking focus from the EditText?
Thanks :)
The easiest thing to do would be to have the onClickListener of those buttons refocus the edit text as their last instruction.
You can also try putting focusable=false (and focusableInTouchMode=false) on the buttons. That may work, I'm not sure if focus is removed from the edit text when the screen is touched or when another item receives focus, which is subtly but important difference here. It would also slightly change any drawables on the button that use focused state.

Android: Hiding view elements when Keypad comes up

Although I am pretty sure this is doable, I just wanted to double check with you all.
I need to hide certain UI elements(like checkbox, lables etc) on the screen when User taps on the edittext field, just before Keypad comes up and take up half the screen. Same should be visible once Keypad is removed from the screen. I am thinking of using View.GONEon those UI elements, but I am not sure how to get them back once the Keypad is removed from the screen.
I want you help in knowing if this is possible, if so how can revert it when Keypad is no more on the screen.
Thanks,
SKU

PhoneGap + Android page doesn't refresh after soft keyboard closes

Most of the time (but not always), when I finish typing in a or and the soft keyboard hides, the view area is left raised with a black space on the bottom. Clicking, tilting or otherwise engaging the phone corrects the screen. However, user's first motion is usually pressing , but if you click submit it jumps down and you actually just click on the text area again. How do you stop this and get the screen to reset after the keyboard closes.
Take a look at you AndroidManifest.xml
http://developer.android.com/guide/topics/manifest/activity-element.html
I think you need to change android:configChanges.
I have the exact same problem what i did was handle hidekeyboard even in javascript and do something like window.scrollTo(0,0) or $("input[type=text],textarea").blur();
This will cause the the screen to get back to normal position
But there is just one problem when click from input field of type = text to a input field password it internally hide the keyboard which causes the hidekeyboard event to fire and scrolls the screen to top. This is the only side effect of this
Let me know if you find the solution for this

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)?

Android - Prevent UI elements from being selected by trackball

So I have a Player view with seekbar and play/pause/rewind, etc. buttons, which are ImageButtons that have pressed and normal states, but no selected states.
Given that there are a number of android devices that have a trackball as alternate input (aside from the touchscreen), is there any way for me to prevent the trackball from focusing some of my UI elements?
Thing is, i want the trackball to be used solely for the seekbar, but I don't want the user to be able to scroll down/up to focus on the other buttons.
I tried setting focusable=false on the elements i don't want to get focus, but it doesn't work.
Is this even possible?
Tryusing
seekbar.requestFocus();
seekbar.setNextFocusUpId(seekbarid);
seekbar.setNextFocusDownId(seekbarid);
seekbar.setNextFocusLeftId(seekbarid);
seekbar.setNextFocusRightId(seekbarid);
This way the seekbar should always regains the focus even when trackball moves.

Categories

Resources