Android ArrayList ListView / Textview - вы должны указать идентификатор ресурса для просмотра текста
В какой-то момент это сработало, и я думаю, что просто ссылаюсь на что-то не так _regionListView, кажется, возвращает ОК. Я думал, что массив внутри ArrayList был проблемой, поскольку он содержал дополнительные нулевые индексы, но я думаю, что я не соединяюсь с ListView и TextView правильно.
Любая помощь будет оценена.
Main.java
String _region = inRegion;
ParserRegion _parserRegion = new ParserRegion();
InputStream _inputStream = getResources().openRawResource(R.raw.regions);
// Parse the Input Stream
_parserRegion.Parse(_inputStream, _region);
// Get Regions
List<PropertiesRegion> _regionList = _parserRegion.GetList();
// Create the ArrayAdapter
ArrayAdapterRegion _arrayAdapter = new ArrayAdapterRegion(getApplicationContext(), R.layout.search_list, _regionList);
// Get reference to ListView holder
ListView _regionListView = (ListView) this.findViewById(R.id.regionListView);
// Set the ListView adapter
_regionListView.setAdapter(_arrayAdapter);
Search.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:adjustViewBounds="true"
android:background="@drawable/search_background"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:scaleType="centerCrop" >
<TextView
android:id="@+id/selectRegionTextView"
android:cacheColorHint="#00000000"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="150dip"
android:gravity="top"
android:textColor="#000000"
android:textSize="20dip"
android:textStyle="bold"
android:typeface="sans" />
<ListView
android:id="@+android:id/regionListView"
android:cacheColorHint="#00000000"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:padding="10dp" />
<Button
android:id="@+id/mainMenuButton"
android:background="@drawable/button_black"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="70dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:typeface="sans"
android:textSize="18dip"
android:textStyle="bold"
android:textColor="@android:color/white"/>
</LinearLayout>
Search_list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/regionTextView"
android:cacheColorHint="#00000000"
android:gravity="center"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:paddingLeft="10dip"
android:textColor="#000000"
android:typeface="sans"
android:textSize="20dip"
android:textStyle="bold"/>
</LinearLayout>