I am trying to show a list of files using an ArrayAdapter into a ListView. As best as I can tell, the following should work but it is just leaving the ListView empty. I am not using a ListActivity.
Java
setContentView(R.layout.files);
findViewById(R.id.folder_use).setOnClickListener(this);
ListView view = (ListView)findViewById(R.id.files);
File[] files = Environment.getExternalStorageDirectory().listFiles();
Log.d(TAG, files.toString());
view.setAdapter(new ArrayAdapter<File>(this, R.layout.file_row, files));
layout.files
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/local_instructions" android:text="@string/local_instructions"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" />
<ListView android:id="@+id/files" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="@id/local_instructions"
android:background="#ffffff" />
<Button android:id="@+id/folder_use" android:text="@string/folder_use" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1" android:layout_alignParentBottom="true" />
</RelativeLayout>
layout.file_row
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
Am I missing something obvious?
Thanks