How the view are refereed under MainActivity In android



Here the XML code for simple text view



<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:id="@+id/test"/>


Then in MainActivity it is used like this



TextView test = (TextView) findViewById(R.id.test);
test.setText("test");


Here I have Doubt how the view accessed in Main class which is defined in xml layout can any explain how it happens


No comments:

Post a Comment