간단합니다.ListView에서 onClick을 구현하는 방법
클릭 할 때 행의 텍스트를 토스트하고 싶습니다. 그리고 내 코드는 다음과 같습니다.
public class AndroidSQLite extends Activity {private SQLiteAdapter mySQLiteAdapter;
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listContent = (ListView)findViewById(R.id.contentlist); mySQLiteAdapter = new SQLiteAdapter(this); mySQLiteAdapter = new SQLiteAdapter(this); mySQLiteAdapter.openToRead(); Cursor cursor = mySQLiteAdapter.queueAll(); startManagingCursor(cursor); String[] from = new String[]{SQLiteAdapter.KEY_NOME}; int[] to = new int[]{R.id.text}; SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to); listContent.setAdapter(cursorAdapter); mySQLiteAdapter.close(); }
}
당신을 감사합니다!
http://stackoverflow.com/a/4993311/925070 [목록보기의 항목에 대한 setOnItemClickListener를 사용 – dimetil
가능한 중복 ] (http://stackoverflow.com/questions/4993026/using-setonitemclicklistener-for-items-in-listview) –