как передать значение строки из списка в кнопку
Я создал кастомlistview
с помощьюSimpleAdapter
И вeach row of list view i put a button имеет один идентификатор.
Я хочу получитьposition
каждой строки, чтобы передать кнопку, но у меня есть один идентификатор кнопки для каждой строки иI want when I click on button it find the position of row and start another activity
Помогите мне, пожалуйста
public void click(View v){
//RelativeLayout navi = (RelativeLayout)findViewById(R.layout.custom_row_view);
TextView tv = (TextView)findViewById(R.id.text1);
ImageButton im = (ImageButton)findViewById(R.id.imageButton1);
ListView lv=(ListView)findViewById(android.R.id.list);
int position = 0;
Long id=Long.parseLong((String) adapter.getItem(position));
Intent i=null;
switch(position){
case 1:
i=new Intent(this, ButtonActivity.class);
startActivity(i);
break;
case 2:
i = new Intent(this, PickerActivity.class);
startActivity(i);
break;
}