ListView に実装されているデータベースを使用しています。
ListView をセクション化し、ヘッダー (セパレーター) を追加したいと考えています。つまり、私には多くの都市があり、区切り記号を使用して国ごとにグループ化したいということです。
これは、ヘッダーと関係があると私が思うクラスです。
String[] adobe_products = getResources().getStringArray(R.array.adobe_products);
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, adobe_products);
// Binding Array to ListAdapter
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, adobe_products));
ListView lv = getListView();
// listening to single list item on click
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
/* // selected item
String product = ((TextView) view).getText().toString();
// Launching new Activity on selecting single List Item
Intent i = new Intent(getApplicationContext(), SingleListItem.class);
// sending data to new activity
i.putExtra("product", product);
startActivity(i);*/