On Apr 29, 9:26 pm, bluedot <[EMAIL PROTECTED]> wrote:
> when i was in android ui test framework i need use the button click
> event to the use the onclick event,but how can i do it.
hi bluedot
this is program for catch the key events this may help you to solve
your problem
create a new project and run this
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;
public class keytry extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DEL) {
Toast.makeText(keytry.this, "mobiledumper", 5000).show();
return true;
}
return false;
}
/** @Override
public boolean onKeyDown(int keyCode, KeyEvent msg) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
myGLView.rotateY(-ANGLE_DIFF);
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
myGLView.rotateY(ANGLE_DIFF);
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
myGLView.rotateZ(-ANGLE_DIFF);
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
myGLView.rotateZ(ANGLE_DIFF);
return true;
}
return false;
}*/
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---