Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. ...
  3. android:id="@+id/layout"
  4. android:onClick="doStuff">
  5.  
  6. <TextView
  7. ...
  8. android:id="@+id/hello_world"
  9. android:textSize="52dp"
  10. android:onClick="doStuff" />
  11.  
  12. </RelativeLayout>
  13.  
  14. public class TestActivity extends ActionBarActivity {
  15.  
  16. @Override
  17. protected void onCreate(Bundle savedInstanceState) {
  18. super.onCreate(savedInstanceState);
  19. setContentView(R.layout.activity_test);
  20.  
  21. TextView view = (TextView) findViewById(R.id.hello_world);
  22. doStuff(view);
  23. Log.d("onCreate", "testing " + view.getId());
  24. }
  25.  
  26. public void doStuff(TextView textView) {
  27. Log.d("test", "text " + textView.getId() + " " + R.id.hello_world);
  28. }
  29.  
  30. public void doStuff(View view) {
  31. Log.d("test", "view " + view.getId() + " " + R.id.layout);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement