Identifying Views:
To work with the Views and perform some operations, the views change their content in Runtime need to be provided with ids in XML.
To provide id for the view, we use android: id attribute
In XML:
Ex: <EditText
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:id=”@+id/et_name”/>
Here the id can be any name with variable naming conventions
In Java:
All the views that change in runtime need to be identified in Activity.
Syntax:
View objName = (View)findViewById(R.id.—-);
Ex: Identifying the EditText from above XML
EditText etName = (EditText)findViewById(R.id.et_name);