General Code XML Layout (activity_main.
xml)
<LinearLayout
xmlns:android="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/et1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Name"/>
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"/>
<TextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Java Code ([Link])
import [Link];
import [Link].*;
import [Link];
public class MainActivity extends AppCompatActivity {
EditText et1;
Button btn1;
TextView tv1;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
et1 = findViewById([Link].et1);
btn1 = findViewById([Link].btn1);
tv1 = findViewById([Link].tv1);
[Link](v -> {
String name = [Link]().toString();
[Link]("Welcome " + name);
});
}
}