0% found this document useful (0 votes)
324 views5 pages

Practical No 10

The document describes two programs to create login forms: 1) A login form for a social networking site with labels, text fields for phone/email and password, and a login button laid out in a vertical linear layout. 2) A login form for a student registration system with labels and text fields for name, address, mobile number laid out in a table with rows, and a submit button. Code snippets in XML and Java are provided to implement the login forms.

Uploaded by

Aakash Chaudhari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
324 views5 pages

Practical No 10

The document describes two programs to create login forms: 1) A login form for a social networking site with labels, text fields for phone/email and password, and a login button laid out in a vertical linear layout. 2) A login form for a student registration system with labels and text fields for name, address, mobile number laid out in a table with rows, and a submit button. Code snippets in XML and Java are provided to implement the login forms.

Uploaded by

Aakash Chaudhari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PRACTICAL NO 10

X.

1. Write a program to create a login form for a social networking site.

CODE:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#3b5998">
<TextView
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Facebook"
android:textSize="30dp"
android:layout_gravity="center"
android:textColor="#fff"/>
<EditText
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Phone number or email address"
android:inputType="text"
android:layout_below="@+id/b1"
android:textColorHint="#fff"
android:layout_gravity="center"
/>
<EditText
android:id="@+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:layout_below="@+id/b2"
android:layout_gravity="center"
android:textColorHint="#fff"/>
<Button
android:id="@+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log In"
android:background="@android:color/holo_blue_dark"
android:layout_below="@+id/b3"
android:layout_gravity="center"
android:textColor="#fff"/>
</LinearLayout>

JAVA CODE

package com.example.myapplication1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = (Button)findViewById(R.id.b4);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this,"LOGGED IN
SUCCESSFULLY",Toast.LENGTH_LONG).show();
}
});

}
}
OUTPUT
2. Write a program to create a login form for student registration system

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:showDividers="middle">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="First name"
android:textSize="20dp"/>
<EditText
android:layout_width="284dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Enter fName"
android:inputType="text"/>

</TableRow>
<TableRow
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Middle Name"
android:textSize="20dp"/>
<EditText
android:layout_width="284dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Enter mname"
android:inputType="text"/>
</TableRow>
<TableRow
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Last Name"
android:textSize="20dp"/>
<EditText
android:layout_width="284dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Enter lname"
android:inputType="text"/>
</TableRow>
<TableRow
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Address"
android:textSize="20dp"/>
<EditText
android:layout_width="284dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Enter Address"
android:inputType="text"/>
</TableRow>
<TableRow
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Mobile Number"
android:textSize="20dp"/>
<EditText
android:layout_width="284dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Enter Mobile No"
android:inputType="text"/>
</TableRow>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Submit"
android:textSize="20dp"
android:layout_gravity="center"/>
</TableLayout>
OUTPUT

You might also like