954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

use volume key to scrolling

Hi
how can i use volume keys and camera key in app ?
i use -36 and - 37 constant value but it`s not work !!!
i use this to get key name

str = getKeyName(keyCode);



but when i press volume keys or camera key it`s return null
i want to use this key`s to scrolling text on touch screen phone`s
can any body help me
thanks

mahdi68
Junior Poster in Training
95 posts since Jun 2009
Reputation Points: 6
Solved Threads: 0
 

EDIT:

Sorry - this is assuming you are talking about the android platform which it seems you may be with those method names and specific buttons in question. Really though - it would really help to know what platform or api level you are on.


if you look at your onKey(Up/Down/LongPress) event there is a KeyEvent event parameter.

Look at the event - or simply call the KeyEvent class.

there is:

KeyEvent.KEYCODE_VOLUME_DOWN
KeyEvent.KEYCODE_VOLUME_UP
KeyEvent.KEYCODE_CAMERA

you will probably need to override the up and down events for these keys anywhere in your application where an activity needs to override them.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

on java platform - with java me

mahdi68
Junior Poster in Training
95 posts since Jun 2009
Reputation Points: 6
Solved Threads: 0
 

is this on the android platform or windows me platform or...?

the java platform (or runtime environment) itself is not enough information to go on. Normally you would want to setup a test loop and press the key in question, trying to capture whatever code was passed as part of the key event.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

i develop this application for java basee mobile phones like nokia s40 or sony ericsson and ...

mahdi68
Junior Poster in Training
95 posts since Jun 2009
Reputation Points: 6
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: