MAD Lab Assignment 5: Name: Zain Mushtaq Sap ID: 70067944 Section: B
MAD Lab Assignment 5: Name: Zain Mushtaq Sap ID: 70067944 Section: B
MAD Lab Assignment 5: Name: Zain Mushtaq Sap ID: 70067944 Section: B
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/Name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="20sp" />
<EditText
android:id="@+id/Department"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="20sp"/>
<EditText
android:id="@+id/Cgpa"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="20sp"/>
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="2dp"
android:divider="@color/teal_700"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn"
android:text="" />
</LinearLayout>
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="20sp"
android:textStyle="bold|italic" />
MainActivity.java
package com.example.lab3t2;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.example.lab3t2.R;
ListView list1;
TextView text1;
Button btn1 ;
@Override
setContentView(R.layout.activity_main);
btn1.setOnClickListener(this);
@Override
if (btn1.getId() == view.getId()) {
array[0]=Edit1.getText().toString();
array[1]=Edit2.getText().toString();
array[2]=Edit3.getText().toString();
list1.setAdapter(adapter);