I have two problems in making a ListView
in Android studio, first of all, I have
a layout in which I want to make a ListView
with around 100 elements that I can click on and
take me to another layout.
1. This is the content of my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="#ffff7e00">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="2"
tools:listitem="@android:layout/simple_list_item_2" />
</RelativeLayout>
In my Preview, next to the XML code, a list of default elements appear, but when I test it in the emulator, is not there, why?
2. I don't know how to edit the ListView
in the java file, and how to set the number of
elements I want there to be, and how to make them lead me to a respective layout.