1:-
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="10sp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Username"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Username"
android:hint="@string/Username"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Password"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Password"
android:hint="@string/Password"
android:inputType="textPassword"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Submit"
android:id="@+id/Submit"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Display"
android:text=""
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="30sp"
android:textColor="@color/black"/>
</LinearLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
EditText username=findViewById([Link]);
EditText password=findViewById([Link]);
Button submit=findViewById([Link]);
TextView display=findViewById([Link]);
[Link](v->{
String Username=[Link]().toString();
String Password=[Link]().toString();
[Link](getString([Link],Username,Password));
}
);
}
}
2:-
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="10sp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Name"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Name"
android:hint="@string/Name"
android:inputType="textPersonName"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DOB"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/DOB"
android:hint="@string/DOB"
android:inputType="date"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/BloodGroup"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/BloodGroup"
android:hint="@string/BloodGroup"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Submit"
android:id="@+id/Submit"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Display"
android:text=""
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="30sp"
android:textColor="@color/black"/>
</LinearLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
EditText name=findViewById([Link]);
EditText dob=findViewById([Link]);
EditText bloodGroup=findViewById([Link]);
Button submit=findViewById([Link]);
TextView display=findViewById([Link]);
[Link](v->{
String Name=[Link]().toString();
String Dob=[Link]().toString();
String BloodGroup=[Link]().toString();
[Link](getString([Link],Name,Dob,BloodGroup));
}
);
}
}