listview
を使用SimpleAdapter
してカスタムを作成し、リスト ビューの各行に単一の ID を持つボタンを配置しました。position
ボタンを渡すために各行を取得したいのですが、各行に単一のボタンIDがあり、ボタンをクリックしたときに行の位置を見つけて別のアクティビティを開始したいのですが、
助けてください
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;
}