sanjay krishnan

Greenhorn
+ Follow
since Jan 27, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sanjay krishnan

You can use below fucntion

boolean android.widget.HorizontalScrollView.arrowScroll(int direction)

For eg:

leftview.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
horview.arrowScroll(View.FOCUS_LEFT);

}
});
rightview.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
horview.arrowScroll(View.FOCUS_RIGHT);

}
});
13 years ago
Animating image in a frame when user press keys(Left and rightarrow key) .image is moving
from left or right based on keypress and prev or next image will be shown .Here is the source code

component.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event){
if(event.getkeyCode()==KeyEvent.VK_RIGHT)
startanimateright();
else if(event.getkeyCode()==KeyEvent.VK_LEFT)
startanimateleft();
}
};

the problem is that when i press leftkey the operation is carried out and prev image is seen.
during the operation when user presses left key again the problem starts(ie the operation
carried out incorrectly).how to avoid this?
i want the event to be happen in sequence.
16 years ago