Android string-array from xml file to ListView

前端 未结 4 463
灰色年华
灰色年华 2020-12-25 10:46

First of all, thank you for your answers! I\'m new for Android and this is my problem;

I want to take values of string array to listview.

Program works fin

4条回答
  •  感动是毒
    2020-12-25 11:04

    remove android:entries from your .xml file & define the string array into

    String[] number = getResources().getStringArray(R.id.numbers);
    ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, number);
    

提交回复
热议问题