Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- ...
- android:id="@+id/layout"
- android:onClick="doStuff">
- <TextView
- ...
- android:id="@+id/hello_world"
- android:textSize="52dp"
- android:onClick="doStuff" />
- </RelativeLayout>
- public class TestActivity extends ActionBarActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_test);
- TextView view = (TextView) findViewById(R.id.hello_world);
- doStuff(view);
- Log.d("onCreate", "testing " + view.getId());
- }
- public void doStuff(TextView textView) {
- Log.d("test", "text " + textView.getId() + " " + R.id.hello_world);
- }
- public void doStuff(View view) {
- Log.d("test", "view " + view.getId() + " " + R.id.layout);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement