android softkeyboard on keypress listener - android

A newbie on Android. Need an example of how can i use soft keyboard. What i want to achieve is on Button click a keyboard should appear and a TextView should be populated with every keypress event with the key pressed. When i try to do so i get NullPointerException. I couldn't understand what exactly the reason could be. Some place i read to initialize my view with onkeylistener, but i couldn't get where and how to do it. Please explain me the steps to implement it. Would be very helpful.

Related

Custom Android Keyboard - Key to Change "Keyboards"

I am creating my own Android Keyboard and I would like to add a key that when pressed it will open up the "Input Methods/Keyboards" dialog so I can change the keyboard.
Pretty much the same functionality the default keyboard has which if you hold "space" it will show a popup that allows you to change to other input method.
I haven't been able to find out if there is any predefined class doing such an action. If you can help me I will really appreciate it.
Thanks

Android: What is the KeyEvent.KEYCODE for "?123" key on soft keyboard?

I want to press "?123" key programmatically. But I don't know the KEYCODE for this symbol. And I also unable to find it. Can anybody know the KEYCODE for "?123" symbol on Soft Keyboard.
It's not an actual key press.
It's just a way for the user to change the keyboard layout to be able to press on symbols etc.
I think it's not even a guarantee that every keyboard has it. There are many custom keyboards on Android and they can make it any way they want it.
You should think for yourself, what are you actually trying to achieve? to insert a "#" for example? then you should just simulate the keycode for that.
If you want to customize at this point, I think you should create a input method from the beginning, with your own keyboard class and own keyboardView.
This way you can do whatever you want in the keyboard.
How to make a Android custom keyboard?

AOSP: Non-focusable but LongClickable TextView

I just downloaded AOSP and modified TextView for my purpose.
I have added a LongClick Listener to the TextView, which shows a simple Toast.
Since I modified the Android framework, it is reflected into all the apps and entire Android OS.
I have now run into a weird issue where the TextView is getting focus in some places and other underlying widgets are not getting any focus. This is creating lot of issues.
For eg: In Settings app, The 'Wi-Fi' text is receiving focus, but I cannot enter the wi-fi settings unless I click in any empty area in the Wi-Fi list item.
(I hope am clear!)
Another example: I am unable to select the Radio Button just because the text corresponding to Radio Button receives focus.
So my question is:
Is there any way I can make TextView non-focusable but receive Long Click events?
Is there any way I can pass the focus down to the parent layout?
Any other way you can suggest?
(PS: Please do not say what I am doing is right or wrong. It's just a feasibility test for what I am trying to achieve.)
A view does have the attributes "focusable" and "longClickable". Have you tried a combination of these?

Android call search function programmatically

In Google Maps, when you click the search box the real search comes up. The search box is just an imageview illusion with an onclicklistener
similarly, if you press the search button on the mobile device, the search box comes up.
I need to implement similar behavior, when the user clicks an image that is over the map (in a relativelayout), the search box for that mapview comes up.
how would I call the mapview's search feature??? I was thinking of just simulating a search button press but I dont even know what this function's name is.
Thanks for the insight!
The function you are looking for is onSearchRequested(). Just make a call on your onClickListener. Complete guide to search implementation can be found here.
http://developer.android.com/guide/topics/search/index.html

android add buttons on top of softkeyboard

I want to add some buttons on top of the soft keyboard (Enter and Cancel). Is there a nice way to do this or do I have to detect the keyboard being shown and add the buttons into my view?
I can't see the logic your trying to apply here.
if you add buttons above your keyboard then you lose some areas in your keyboard (for example you cant press on q w s a).
I think you should look into creating your own custom keyboard.
maybe this will help
android app specific soft keyboard
Jason
You won't be able to do this, and with good reason. If apps could modify an existing input method like this, they could trivially log all keystrokes on your device without you knowing. If you've ever installed a custom input method, you'll see a big warning that using it means trusting it not to log your keystrokes, and the functionality you're after would totally circumvent that protection.

Categories

Resources