コード例 #1
0
  private void initListView() {
    List<String> idsList = ProjectUtil.getIdListSharedPreference(this);
    listView = (ListView) findViewById(R.id.list_station_choice);
    adapter = new AddStationAdapter(this, stationList, idsList);
    listView.setAdapter(adapter);
    adapter.setOnItemClick(
        new OnItemClick() {

          @Override
          public void onItemClick(int position) {
            // TODO 自动生成的方法存根

          }
        });
  }
コード例 #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // TODO Auto-generated method stub
   ArrayList<String> selectedList = new ArrayList<String>();
   if (item.getItemId() == android.R.id.home) {
     // for (StationBase sta : stationList) {
     // if (sta.getIsSelectedBool())
     // selectedList.add(sta.getId());
     // }
     Intent intent = new Intent();
     // intent.putStringArrayListExtra(INTENT_SELETED_STATION,
     // selectedList);
     ProjectUtil.setIdListSharedPreference(this, adapter.getIdsList());
     setResult(RESULT_CODE_SELECT_STATION, intent);
     finish();
     return true;
   }
   return super.onOptionsItemSelected(item);
 }