Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onClick(View v) {
- Field f;
- int rid;
- String name = "unknown View";
- try {
- f = R.id.class.getDeclaredField(Integer.toString(v.getId()));
- rid = f.getInt(f);
- name = MainActivity.this.getString(rid);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- Log.v(LOG_TAG, String.format("%s was clicked!", name));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement