Skip to content

Instantly share code, notes, and snippets.

@seungwoonlee
Created February 10, 2013 18:51
Show Gist options
  • Save seungwoonlee/4750594 to your computer and use it in GitHub Desktop.
Save seungwoonlee/4750594 to your computer and use it in GitHub Desktop.
Android UserInput Logging
package com.example.userinput;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
public class UserInputActivity extends Activity {
private static final String TAG = "UserInputActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_user_input); // View ¸¦ »ý¼ºÇÏÁö ¾Ê´Â´Ù.
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.i(TAG, "onKeyDown:" + keyCode + event.toString());
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Log.i(TAG, "onKeyUp:" + keyCode + event.toString());
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.i(TAG, "onTouchEvent:" + event.toString());
return super.onTouchEvent(event);
}
@Override
public boolean onTrackballEvent(MotionEvent event) {
Log.i(TAG, "onTrackballEvent:" + event.toString());
return super.onTrackballEvent(event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment