Android dialog keyboard navigation - Android Q&A, Help & Troubleshooting

Let say for some reason I have gotten a code where the main activity will present a dialog to allow the user to confirm exit or just cancel, I would like to implement that the user can use the arrow key to move left and right or rotate back to the two buttons ( cancel or ok ), how do I do it in code ?
I found many solutions using the XML method where the view will have the android:nextFocusRight="@+id/button2". But how could this be done programmatically ?
I could not find the equivalent using java code.
Thank you very much.

Related

Hardware keyboard translation for HP 600, Touch Dual, Asus p750

Hi ,
I have written a small application:
http://rapidshare.com/files/125258935/HebKeys_tog198.CAB.html
This application is designed for window mobile 6 devices that has a numeric keyboard,
one of the problems with this type of devices is that there isn't language support for them, for example if you want to write sms in hebrew or russion using this keyboard it is impossible.
After installing this application a XML file (layout.xml) will be coppied to your device containning all the translation of the keyboard. (this xml is configure to HP 600 !!! it will not work on other devices)
The xml file contains group of hardware keys (for example):
<keys>
<HWcode>48</HWcode>
<state1>0</state1>
<state2>ך</state2>
<state3>ן</state3>
<state4>ף</state4>
</keys>
in this example hardware key 48 will contain the following signs: 0-zero, "ך" - hebrew sign, "ן" - another hebrew sign, "ף" and another hebrew sign.
clicking on hardware key 48 (0 in the hardware keyboard of the hp 600) will itirate between does "states".
This application will run in the background, for toggeling it's translation use your Voice button (key 198) or configure it to different button:
<tog>
<HWcode>198</HWcode>
</tog>
you can of course configure yourself the signes and hardware keys to mach your device.
I written another application in order to help you find what is the hardware code for every key in your device:
http://rapidshare.com/files/125091730/KeyMap_13.zip.html
this two applications will not run together, so make sure you are closing one before running the other (SR is also agood idea).
Pls backup all your data before installing the applications.
link to the original thread (hebrew):
http://www.pocketpcfreak.com/cgi-bin/yabb/YaBB.cgi?board=Himalaya;action=display;num=1214408412
have fun
Rani
HW keyboard working on 3rd party apps in Dual
Great news to those using Touch Dual with 20keys and are fustrated with the HW keyboard typing only numbers on 3rd party apps (like Opera, Google Search etc.) - this HebKeys app by Golum can provide a reasonable solution.
Limitations:
- No XT9.
- No Shift or Capital letters.
- No symbol window access (SYM is not active).
- Long delay is required in words that have two consequent letters mapped to the same key (e.g. REad, because R and E are on the same key). Alternatively, if an unmapped key is pressed (SYM), you can re-press the key again and get the next letter.
BTW, Golum promised to provide an update with an option to update the value of this delay through an xml file.
How to install:
1. download the HebKeys app by Golum, from http://rapidshare.com/files/125260462/HebKeys_button198.CAB.html
2. download the following key mapping layout that I have created: http://www.4shared.com/file/52928436...55/layout.html
3. after installing the app, replace the layout.xml file in the app folder (under Program Files) with the layout.xml file that you downloaded in 2.
Now what you need is to run the installed app and the re-mapping is done (need to re-run it after soft-reset).
If you run the app after it was activated, you can stop it using the "Exit" button. BTW, it is possible that the link above by Golum is for a slightly different version than the one in the link I provided, in which the default when running the app is the "unmapped keyboard" and there's no option to exit (no Exit button). Golum? I personally prefer the one with the Exit option.
If you wish to play with the mapping layout, you can edit the XML yourself. It is quite readable. Notice you cannot put less than 4 options (representing 4 repeating presses) to each key.
The last key mapped is for toggling the mapping on and off (the app is still in the background). Default is the ALT key.
The mapping of the HW keys of the 20key Dual is as follows (in the order it appears on the keyboard):
81 49 50 51 79
65 52 53 54 76
90 55 56 57 8
236 119 48 120 13
If you have a different device, you can try the key mapping app in the link from my previous post, to get the mapping.
Regarding Hebrew:
The layout file that I have provided solves the keyboard problem, but replaces the Hebrew support in the original layout included with the HebKeys app. However, I found that if you have Eyron Hebrew support installed, when the HebKeys is activated and you switch to Hebrew in the Eyron soft keyboard you can use the keyboard to write Hebrew!
If you think you managed to improve it, added the Shift or Sym functionality etc. - please share with all.
Enjoy.
Update:
Please note that I have updated the layout.xml a little, so if you already downloaded it - please re-download and re-copy to the proper folder.
If you really insist to know why I udpdated:
I found out the key I used for space is actually &NBSP, which seems like a space but is not exactly a space.
For some reason putting merely a space character in the XML does not work (not recognized, probably removed by the XML interpreter), so I added a NULL character afterwards, to turn it into a significant space.
Great App, seems to be the most awaited fix for the XDA Stealth keypad. Thanks GOLUM.
- Long delay is required in words that have two consequent letters mapped to the same key (e.g. REad, because R and E are on the same key). Alternatively, if an unmapped key is pressed (SYM), you can re-press the key again and get the next letter.
BTW, Golum promised to provide an update with an option to update the value of this delay through an xml file.
Click to expand...
Click to collapse
Is it possible to use the joystick or navigation pad (right) to be able to move the cursor right away to type the next character? I used to do this on my Nokia days before.
and by the way, is there anyway to do a toogle with this one for enabling and disabling? i mean there would be a toggle that would enable this and use your configured XML as the layout then a toggle OFF to use the default or original keyboard layout. That would be awesome!
The cursor key may not be the greatest idea, as it also functions to move the curser around. It depends on the application - in some it will give you exactly what you want, in others it will move away from the location of the next word.
An alternative option is to use an unmapped key or one that is mapped to nothing, as I explained (I use SYM).
Reg toggle - as explained in the posts the last key in the layout.xml is the toggle key definition. Default is ALT.
Please note that I have updated the layout.xml a little.
If you really insist to know why I udpdated:
I found out the key I used for space is actually &NBSP, which seems like a space but is not exactly a space.
For some reason putting merely a space character in the XML does not work (not recognized, probably removed by the XML interpreter), so I added a NULL character afterwards, to turn it into a significant space.
can u provide this too on xda stealth?
Space
I cannot make a space?
HOw should I write it in text editor?
Pls Help!
space
"space" works with "0"-button, without <HWcode>48</HWcode>... in layout.xml
suggestion
tried this on my stealth, with the Layout.xml file changed to a regular eng to replace the multitap on my stealth, so far it's working fine with the exception of only 4 characters assignment on each hardware keys.. Can the maker or someone set the assignment to 5 char per key so we can accomodate the letters and number for 7 and 9..
WOW AWESOME!!
it is working properly on my stealth..
now i can write a message faster than before..
Thanks a Lot GOLUM
hopefully it can 5 char/key on the next release..
can someone plz upload the layout file for the touch dual again?
tnx

[28 March 2009]Start Menu Button Hook v. 0.3

StartButton.
25 February 2009 v. 0.1 - First release
5 March 2009 v. 0.2 - changes:
+ option to intercept the tap on the text on the right of the start button, usually "Start"
I don't think it is a good idea, but since someone requested it...
+ option to specify the full path to the launched program, works for programs on memory card
28 March 2009 v. 0.3 - changes:
+ option to hook the hardware Window Buttons for devices that have it
Developed with iLaunch (http://forum.xda-developers.com/showthread.php?t=486618) in mind, it's a very simple application: you can specify a program, and it will be run when you "tap" on the start icon.
It's main purpose is to replace the Start Menu with another "launcher" application, allowing to access anyway to the Windows Start Menu by tapping on the right of the Start Button.
Someone requested to extend the hook to the "hardware Start Button", but afaik there is not such a standard hardware button, at least on WM5 and WM6.
Some devices have an hardware button for the Start Menu, some don't, some don't have hardware buttons at all.
There are other applications that can manage hardware buttons, StartButton is for the icon!
It's based on the code of GreenButton by Supbro (http://forum.xda-developers.com/showthread.php?t=462963)
Both are open source GNU GPL V3
StartButton source is at Google Code:
http://code.google.com/p/startbutton/
How to start a program?
HKCU\software\iApps\StartButton\Run
the default value is: "iLaunch\iLaunch.exe" (without the ")
You can specify here a relative path to your program files folder: in an english wm program files folder is, well, "Program Files", and usually applications are located inside it.
so if you want to use say "MyApplication.exe" wich is inside the "MyApplicationFolder" wich is inside the "Program Files" folder:
the full path is:
\Program Files\MyApplicationFolder\MyApplication.exe
and then you need to write:
MyApplicationFolder\MyApplication.exe
if you want to start an application that is not on the Program Files folder, you can write the full path instead:
\Memory Card\Program FIles\MyApplicationFolder\MyApplication.exe
How to extend the hook to the "Start" text?
HKCU\software\iApps\StartButton\HookText
Set this value to 1 for hooking the word "Start"
Delete the key for hooking only the Start button
You have to soft reset your device for the changes to have effect
How to extend the hook to the hardware button?
HKCU\software\iApps\StartButton\HookWinKey
Set this value to 1 for hooking the hardware button
Delete the key for hooking only the screen Start button
You have to soft reset your device for the changes to have effect
thanks a TON for this man, it was exactly what I needed!
thanks again
btw, how much RAM does it consume?
mbarvian said:
thanks a TON for this man, it was exactly what I needed!
thanks again
btw, how much RAM does it consume?
Click to expand...
Click to collapse
According to fdcTaskManager, 1Kb
wow, this is awesome! have always wanted something like this! thank you.
It doesn't work on my Glofiish X600. When is enabled the start menu icon doesn't respond no matter what application I define in registry. When I disable it start menu returns to normal.
dancer_69 said:
It doesn't work on my Glofiish X600. When is enabled the start menu icon doesn't respond no matter what application I define in registry. When I disable it start menu returns to normal.
Click to expand...
Click to collapse
You have to soft reset the device when you change the registry value.
And could you post the path you entered in the registry?
Hmm, maybe someone could use this hack to make a WM 6.5 style launcher...
Just out of curiosity, is there any reason you elected to make this an application instead of a service? I'm not being critical I was just curious because I'm in the early stages of developing a GUI-less application as well and I'm trying to decide which is the best way to implement (service vs application).
Great work!
lotion said:
Just out of curiosity, is there any reason you elected to make this an application instead of a service? I'm not being critical I was just curious because I'm in the early stages of developing a GUI-less application as well and I'm trying to decide which is the best way to implement (service vs application).
Great work!
Click to expand...
Click to collapse
The real reason is that GreenButton is an application, and StartButton is based on GreenButton source code...
But probably changing to a service is a good idea
allelimo said:
You have to soft reset the device when you change the registry value.
And could you post the path you entered in the registry?
Click to expand...
Click to collapse
I didn't soft reset everytime and I tried with appilcations in storage card.
This is only for main memory's program files path I suppose.
Is there any way to start a program from another path and mostly from storage card?
Help
So how to I map this To my program list are menu.?
dancer_69 said:
I didn't soft reset everytime and I tried with appilcations in storage card.
This is only for main memory's program files path I suppose.
Is there any way to start a program from another path and mostly from storage card?
Click to expand...
Click to collapse
As for now (version 0.1) StartMenu and the target application must be in the main memory, I'm sorry but I didn't clearly stated this...
nucentury08 said:
So how to I map this To my program list are menu.?
Click to expand...
Click to collapse
Sorry, I don't understand your question
Update(01/03/09): Implemented display scaling so more apps work. New version based on android 1.1 with working Gmail, Calendar and Market.
bug with new version for Vogue
When screen shut off with End Call Button Screen placement is random
Is this just for a hardware button or can it replace a screen tap as well? I ask only because I have no hardware start button on my device.
theoneownz said:
Update(01/03/09): Implemented display scaling so more apps work. New version based on android 1.1 with working Gmail, Calendar and Market.
bug with new version for Vogue
When screen shut off with End Call Button Screen placement is random
Click to expand...
Click to collapse
Wrong thread I guess...?
zarxic said:
Is this just for a hardware button or can it replace a screen tap as well? I ask only because I have no hardware start button on my device.
Click to expand...
Click to collapse
It's not for the hardware button, it intercepts the click (or "tap") on the Start Menu icon.
can you make it fully replace startmenu? not just icon press?...if so please do another version
pcarvalho said:
can you make it fully replace startmenu? not just icon press?...if so please do another version
Click to expand...
Click to collapse
i was about to say that also, thank you
i still get the menu if i press the text....
+1 for full interception
+1 full start menu

[Request] A hotkey manager/creator

With the release of the Xperia Play specifically, it'd be nice if we had a way to create system wide, and per-program hotkeys.
For example, the camera app has X mapped as the shutter button. With this program we could set it so when the camera app is running, that R will take a picture (so we can do it with the camera closed) and in the home menu, pressing L and R together will open the camera program.
Some games/apps are programmed to let us map buttons, but very few use the analog touchpad. It'd be nice if we could map the different directions to different keys, so we could get rudimentary support for them in existing apps.
Now for those apps that dont use buttons at all, it could send touchscreen presses to them. You'd need a way to do this within the app itself so you could see where you're going to press it. Perhaps via a something (a widget?) in the notification slider, that takes a screenshot and brings up the menu, to let you select the X/Y coordinate to send. This would work great for the touchpad and virtual on-screen analog sticks
Now I can understand if you guys dont want to waste your time, but if you can provide me the necessary API, when I get the hang of Android development I could do it in time. Assuming it works like Windows, I'd need equivalent API to:
-listen for key presses even when the app is not in focus
-detect which app is in focus
-send artificial key/touchscreen events to that app
-take a screenshot of that app
Also, if you can provide the API to run the current Live Wallpaper in the background, it would help for another project I'd like to do.
Great project, with i could help you out. But i dont understand a thing about programming

redirect Q home screen to a launcher

By default, the Q has no launcher, and instead uses 'broker' as the default launcher, which has no interface, only loads up the visualizer. You cannot change this with a home switcher or any other app capable of changing the launcher. I haven't been able to find how exactly the Q is doing this, but I did find a workaround.
This assumes you are already rooted, you have a controller connected via OTG cable and have Nova launcher installed. This will work with other launchers but you will have to write your own app to launch something else.
For me, the solution consists of:
- Connect a controller of your choosing (logitech K400), and install Nova launcher
- Identify the Scan Code of the button you would like to use as a 'Home' key (KeyTool.apk attached to help find it easily if not a standard home button)
- Remap the 'CALL' action to the button you want to use. (I chose CALL since is of no use to the Q.)
- Install a small app to intercept the 'CALL' intent and fire up your launcher
1) To connect a controller, you will need a OTG cable. I wont go into this since others have already covered this in detail. Here's a good example: http://davidnhutch.com/sandbox/blog/connect-a-mouse-and-keyboard-via-usb/
2) If your controller already has a home button, and it is already kicking you to the visualizer, the scan code you're looking to intercept is probably 172. If not, you can install KeyTest.apk (attached credits solarbanjo at mobileread.com forums) on the Q and it will tell you the scancode when you press each button.
3) Now, you need to edit the Q's keylayout file (found in /system/usr/keylayout/Generic.kl) and point that key declaration to 'CALL' instead of 'HOME'. Find the number that cooresponds to your scan code, and change the action to CALL.
BTW There are probably multiple key layout files in this folder. I've attached my Generic.kl for reference, but if you're not using the same keyboard this might not be useful. Compare to yours and change accordingly.
Note: If you edit Generic.kl it will change the default action for any new device that is connected. The *proper* way to do this is to create a device specific key layout, but I didn't bother because I'm lazy.
You can find more detail about this part here: http://chris.boyle.name/2010/08/android-keymaps and here: http://www.mobileread.com/forums/showthread.php?t=159538
4) Install HijackDialer.apk (attached). This app is simple, all it does is received the dial intent and launches Nova. No need to run as service since its the only app registered to the dialer intent. Ideally, this would allow you to choose your launcher but this works for now.
I also mapped My F1 - F11 Keys to other actions like BACK, FORWARD, POWER etc. Now my keyboard can control the Q completely and I can get to my launcher without having to send adb commands. All I'm missing now is a 'close' button to kill locked up apps that don't behave on the Q.
I'm sure I may have glossed over some details but hope this helps someone.
Great work. I'll try this out this week.
Sent from my Nexus 7
I know this was posted some time ago but everytime I tried to change the Value an press sabe it say error can save. same thing happen trying to put the tablet xml also trying to change the dpi value is there something I have to do to edit system stuff
Forget it found my mistake need to be root to edit files just download Rom toolbox

Air mouse mapping help

Hey guys,
I work for an IPTV provider and we decided to ship out some of those S905 boxes to be used as STB's. We have a third party writing the app to access our service, it works great with classic STB's, but the Android version only accepts touch screen input. We can cheat it by swiping with an air mouse. I am trying to remap a couple of keys on the air mouse remote controls to act as swipe gestures (which also change channels), so we can ship those boxes with updated key maps, while we wait for the developer to fix the Android app code.
Specific questions:
1) Is there a way to make a key map, app-specific? So that the system only applies the key map when the app is open and goes back to the default key map for the device for everything else?
2) Is there something like evtest for Android that will capture input and also give me key codes? (that will make re-mapping the keys a lot easier lol)
TIA for any help you can give me. If this is not the right forum for this, please point me there.

Categories

Resources