高度なListViewのお話
ListViewのlist_itemに複数のウィジェットを配置する場合にArrayAdapterを拡張する必要がある
// リストのアイテムデータ public class BluetoothDeviceInfo { String BluetoothAddress; String BluetoothDeviceName; } // リストデータ BluetoothDeviceInfo[] listData; // ListViewに設定 ListView list = (ListView)this.findViewById(R.id.listViewDeviceList); list.setAdapter(new MyListAdapter()); // ListViewに設定するAdapterクラス private class MyListAdapter extends ArrayAdapter<BluetoothDeviceInfo> { public MyListAdapter() { super(BluetoothDeviceList.this, R.layout.list_item, listData); } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = getLayoutInflater(); row = inflater.inflate(R.layout.list_item, parent, false); } TextView lbl = (TextView)row.findViewById(R.id.textViewBluetoothAddress); lbl.setText(listData[position].BluetoothAddress); lbl = (TextView)row.findViewById(R.id.textViewBluetoothDeviceName); lbl.setText(listData[position].BluetoothDeviceName); return row; } }