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

Android User Login and Info Display

The document provides an Android application code that accepts a username and password from the user through a graphical interface. It includes XML layout files for the user interface and Java code for handling user input and displaying a success message. Additionally, it outlines a second part of the application that collects and displays student information such as name, age, and mobile number.

Uploaded by

ganeshkumbhar638
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)
13 views5 pages

Android User Login and Info Display

The document provides an Android application code that accepts a username and password from the user through a graphical interface. It includes XML layout files for the user interface and Java code for handling user input and displaying a success message. Additionally, it outlines a second part of the application that collects and displays student information such as name, age, and mobile number.

Uploaded by

ganeshkumbhar638
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

Q.

Write a program to accept username and <LinearLayout


password from the end user using Text View android:layout_width="match_parent"
and Edit Text. android:layout_height="wrap_content"
activity_main.xml android:gravity="center"
android:layout_marginTop="10dp">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout <Button
xmlns:android="[Link] android:id="@+id/btn"
es/android" android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="[Link] android:text="Submit"
auto" android:onClick="setdata"/>

xmlns:tools="[Link] </LinearLayout>
android:id="@+id/main"
android:layout_width="match_parent" <TextView
android:layout_height="match_parent" android:id="@+id/text1"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_margin="20dp" android:layout_height="wrap_content"
android:gravity="center" android:layout_marginTop="30dp"
tools:context=".MainActivity"> android:textSize="20dp"
android:gravity="center"
<TextView android:text=""/>
android:layout_width="match_parent"
android:layout_height="wrap_content" </LinearLayout>
android:text="Username : "
android:textSize="20dp"/> [Link]
<EditText
android:layout_width="match_parent" package [Link].practicalno7_1;
android:layout_height="wrap_content"
android:hint="Enter username" import
android:inputType="text"/> [Link];
<TextView
android:layout_width="match_parent" import [Link];
android:layout_height="wrap_content" import [Link];
android:text="password : " import [Link];
android:textSize="20dp"/> import [Link];
<EditText
android:layout_width="match_parent" public class MainActivity extends
android:layout_height="wrap_content" AppCompatActivity {
android:hint="Enter username" TextView tnm;
android:inputType="textPassword"/> Button btn;
@Override Q. Write a program to accept and display
protected void onCreate(Bundle personal information of the student.
savedInstanceState) {
[Link](savedInstanceState); activity_main.xml
setContentView([Link].activity_main); <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
tnm=(TextView)findViewById([Link].text1); xmlns:android="[Link]
btn=(Button) findViewById([Link]); /android"
} xmlns:app="[Link]
public void setdata(View view) auto"
{ xmlns:tools="[Link]
[Link]("Login Successfully"); android:layout_width="match_parent"
} android:layout_height="match_parent"
} tools:context=".MainActivity"
android:layout_margin="5dp"
android:orientation="vertical">

<TextView
android:id="@+id/txtlebl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="STUDENT INFORMATION"
android:gravity="center"
android:textSize="30sp"
android:layout_marginTop="5sp"
android:padding="10dp"
android:background="#952FA6"
android:textColor="#FFFFFF"
/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">

<TextView android:id="@+id/tnm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Student Name :"
android:textSize="25dp"
android:layout_marginTop="10sp"
android:padding="10dp"
android:textColor="#1B0202" android:layout_height="wrap_content">
/> <TextView
<EditText android:id="@+id/txtmobno"
android:id="@+id/edtname" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="Mobile No :"
android:padding="10dp" android:textSize="25sp"
android:ems="10" android:layout_marginTop="10sp"
android:inputType="text" android:padding="10dp"
android:text="" android:textColor="#050000"
android:layout_marginTop="15dp" />

/> <EditText
</LinearLayout> android:id="@+id/edtmob"
<LinearLayout android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:padding="10dp"
android:orientation="horizontal"> android:inputType="text"
<TextView android:text=""
android:id="@+id/txtage" android:ems="10"
android:layout_width="wrap_content" android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:text="Age :"
android:textSize="25sp" />
android:layout_marginTop="10sp" </LinearLayout>
android:padding="10dp"
android:textColor="#050000" <Button
/> android:id="@+id/button"
<EditText android:layout_width="wrap_content"
android:id="@+id/edtage" android:layout_height="wrap_content"
android:layout_width="match_parent" android:onClick="setdata"
android:layout_height="wrap_content" android:text=" SUBMIT "
android:padding="10dp" android:layout_gravity="center"
android:inputType="text" android:layout_marginTop="30dp"
android:text="" android:textSize="25dp"
android:ems="10" android:padding="10dp"
android:layout_marginTop="15dp" />
<TextView
/> android:id="@+id/txtstud"
android:layout_width="match_parent"
</LinearLayout> android:layout_height="wrap_content"
<LinearLayout android:text=""
android:layout_width="match_parent" android:textSize="25sp"
android:layout_marginTop="20sp" TextView tnm, tage, tmob;
android:padding="10dp" EditText enm, eage, emob;
android:textColor="#050000" Button btn;
/>
<TextView @Override
android:id="@+id/txtstudage" protected void onCreate(Bundle
android:layout_width="match_parent" savedInstanceState) {
android:layout_height="wrap_content" [Link](savedInstanceState);
android:text="" setContentView([Link].activity_main);
android:textSize="25sp" enm=(EditText)
android:layout_marginTop="10sp" findViewById([Link]);
android:padding="10dp" eage=(EditText) findViewById([Link]);
android:textColor="#050000" emob=(EditText)
/> findViewById([Link]);
`<TextView
android:id="@+id/txtmob" tnm=(TextView)findViewById([Link]);
android:layout_width="match_parent"
android:layout_height="wrap_content" tage=(TextView)findViewById([Link]);
android:text=" "
android:textSize="25sp" tmob=(TextView)findViewById([Link]);
android:layout_marginTop="10sp" btn=(Button) findViewById([Link]);
android:padding="10dp" }
android:textColor="#050000" public void setdata(View view)
/> {
</LinearLayout> [Link]("Name :"
+[Link]().toString());
[Link]
[Link]("Age :"+[Link]().toString());
package [Link].practicalno7_1; [Link]("Mobile
No :"+[Link]().toString());
import }
[Link]; }

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link].practicalno7_1.R;

public class MainActivity extends


AppCompatActivity {

You might also like