나는 SimpleAdapter
을리스트 어댑터로 사용하여 ListActivity
을 확장하는 클래스가 있습니다. 내 코드는 다음과 같습니다.listview의 버튼 - android
public class ListOfFirms extends ListActivity {
Intent extras;
int time;
String km;
ArrayList<String> firms = new ArrayList<String>();
SimpleAdapter adapter;
static final ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.firms);
extras = getIntent();
time = extras.getIntExtra("time", 0);
km = extras.getStringExtra("km");
adapter = new SimpleAdapter(
this, list, R.layout.taxi_custom,
new String[] {"name","price"},
new int[] {R.id.taxi_name,R.id.taxi_price});
initializeFirm();
setListAdapter(adapter);
}
제 질문은 목록의 각 요소에 단추를 추가하는 방법입니다. 단추는 오른쪽으로 이동해야합니다. 내 목록에 클래스 Firm
의 개체가 포함되어 있습니다. 사용자가이 단추를 누르면 목록에서 어떤 개체를 가져올 지 어떻게 알 수 있습니까?