Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. @Override
  2. public void onClick(View v) {
  3. Field f;
  4. int rid;
  5. String name = "unknown View";
  6. try {
  7. f = R.id.class.getDeclaredField(Integer.toString(v.getId()));
  8. rid = f.getInt(f);
  9. name = MainActivity.this.getString(rid);
  10. } catch (Exception e) {
  11. e.printStackTrace();
  12. } finally {
  13. Log.v(LOG_TAG, String.format("%s was clicked!", name));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement