public class Db1 extends ListActivity {
 static final String COL1="line";
 final Class[] classNames = {test.class, test2.class, test3.class};
 
 private SimpleCursorAdapter adapter;
 private TextView text;
 private EditText edit;
 public DBAdapter db;
   
 /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        db = new DBAdapter(this);
        db.open();
        
        text = (TextView)findViewById(R.id.text);
        edit = (EditText)findViewById(R.id.edit);
        
        ((Button)findViewById(R.id.add)).setOnClickListener(listener);
        ((Button)findViewById(R.id.del)).setOnClickListener(listener);
        ((Button)findViewById(R.id.detail)).setOnClickListener(listener);
        setEnabled(false);
    }
    
    protected void onResume() {
     super.onResume();
     
     Cursor c = db.fetchAllMemo();
     startManagingCursor(c);
     
     String[] from = new String[] { BaseColumns._ID, COL1 };
     int[] to = new int[] {R.id.id, R.id.memo};
     
     adapter = new SimpleCursorAdapter(
       this, R.layout.row, c, from, to);
     setListAdapter(adapter);
    }
    
    protected void onPause() {
     super.onPause();
     db.close();
    }
   
    protected void onListItemClick(ListView l, View v, int position, long id) {
     super.onListItemClick(l, v, position, id);
     
     TextView t = (TextView)v.findViewById(R.id.memo);
     edit.setText(t.getText());
     text.setText(Long.toString(id));
     setEnabled(true);
      //Intent intent = new Intent(Db1.this, classNames[position]);
      //startActivity(intent); 
    }    
    
    private void setEnabled(boolean enabled) {
     ((Button)findViewById(R.id.del)).setEnabled(enabled);
     ((Button)findViewById(R.id.detail)).setEnabled(enabled);
    }
    
    Button.OnClickListener listener = new View.OnClickListener() {
  @Override
  public void onClick(View v) {
   String id = text.getText().toString();
   String str = edit.getText().toString();
   
   switch(v.getId()) {
   case R.id.del:
    db.delMemo(id);
    break;
   case R.id.detail:
    //Intent intent = new Intent(Db1.this, classNames[]);
       //startActivity(intent);  
    if(str.length() !=0)
     db.modMemo(id, str);
    else
     db.delMemo(id);
    break;
   case R.id.add:
    if(str.length() !=0)
     db.addMemo(str);
    break;
   default:
    Toast.makeText(getBaseContext(), "Error!", Toast.LENGTH_LONG).show();
   }
   
   text.setText("");
   edit.setText("");
   setEnabled(false);
   
   Cursor c = db.fetchAllMemo();
   startManagingCursor(c);
   adapter.changeCursor(c);
   
  }
 };
    
}



위 코드에서요..

버튼 클릭에 대한 리스너(line 63부터)에 대해서
case detail이 문제인데요.
리스트 항목을 선택함에 따라 인텐트로 액티비티를 전환하려고 합니다
근데,, 몇번째 리스트 인지 버튼클릭리스너 안에서는 확인 할 길이 없네요.

만약에 line54처럼 리스트 클릭에 대해서는 position을 이용해서 액티비티 전환이 가능한데
이경우 리스트 삭제를 어떻게 처리할지 몰라서요..

혹은 해결법으로 리스트롱클릭은 인텐트 넘기는 함수로하고
그냥 클릭에서 삭제를 할까도 싶은데,,
리스트 롱클릭에 대한 함수가 있나요??
onListItemClcik 처럼요.. 답변 부탁드립니다.