0% found this document useful (0 votes)
3 views2 pages

List View

The document contains an XML layout for an Android application with a ListView that displays a list of tutorials. It also includes a Java class for the MainActivity, which sets up the ListView with an ArrayAdapter to populate it with tutorial names. The application is structured to utilize Android's AppCompatActivity for compatibility with various Android versions.

Uploaded by

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

List View

The document contains an XML layout for an Android application with a ListView that displays a list of tutorials. It also includes a Java class for the MainActivity, which sets up the ListView with an ArrayAdapter to populate it with tutorial names. The application is structured to utilize Android's AppCompatActivity for compatibility with various Android versions.

Uploaded by

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

<?xml version="1.0" encoding="u -8"?

>

<LinearLayout

xmlns:android="h p://schemas.android.com/apk/res/android"

xmlns:app="h p://schemas.android.com/apk/res-auto"

xmlns:tools="h p://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context=".MainAc vity">

<ListView

android:id="@+id/list"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

</LinearLayout>
package com.example.app; // Example package name
import android.os.Bundl

import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatAc vity;

public class MainAc vity extends AppCompatAc vity {

ListView l;
String tutorials[] = {
"Algorithms", "Data Structures",
"Languages", "Interview Corner",
"GATE", "ISRO CS",
"UGC NET CS", "CS Subjects",
"Web Technologies" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac vity_main);

l = findViewById(R.id.list);
ArrayAdapter<String> arr;
arr = new ArrayAdapter<String>(
this,
R.layout.support_simple_spinner_dropdown_item,
tutorials);
l.setAdapter(arr);
}
}

You might also like