出现错误
字符串资源ID#0x3
listSongYear返回完整长度,但未将其放在列表视图中
if (listSongYear != null) /*size=3*/ {
mSongsAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, listSongYear);
listView.setAdapter(mSongsAdapter);
}
布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.ali_slate.musicmvc.list.sortOutSongs">
<ListView
android:id="@+id/sortoutsongslist"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
答案 0 :(得分:0)
确保您的String []仅包含非null值,因为数组中的null值将导致异常