HOME > Android > Android Listview For Beginners - How To Code A List

Android ListView for beginners - how to code a list

When programming an Android app with Java Android, you can create a so-called ListView. This is a list of values that can be scrolled up and down. The data in this list either comes from a server or is stored directly in the app.

How to create an Android ListView?

The Android Developer documentation explains exactly how to insert the ListView element. However, you should already have basic app development experience to fully understand this documentation. However, you can create a ListView without any prior knowledge, for this you use the Android Studio.
  1. Download Android Studio and install the program on your computer.
  2. Open Android Studio and create an app by entering your Company Domain and otherwise leave everything at "Default".
  3. Select an Empty Activity and then the default. Now you can launch the app directly. To do this, click on the green play button and select "Create New Virtual Device".
  4. In the activity_main.xml replace the entire middle code after <tools:context="."> with <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="match_parent" />.
  5. Nun müssen Sie in der MainActivity.java Ihre Listview noch füllen, indem Sie MainActivity von ListActivity erben lassen und dann in die onCreate() Methode
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,eintrag)); schreiben.

By Hrutkay

Amazon: Contact seller - this option is available :: Play invisibly on Steam: Thanks to this setting, it works
USEFUL LINKS