제가 커스텀뷰에 텍스트와 버튼이 있는데 텍스트는 클릭하면 그에 해당하믄
디비의 값이 일단은 테스트용을 토스트만 출력되게 했는데 제대로 출력이 됩니다.
근데 버튼은 첫번째 디비항목만 넘어가네요
버튼 클릭시 해당하믄 디비값을 읽어오려면 어떻게 해야 하나요 ?
if(cursor.getCount()>0){
startManagingCursor(cursor);
DBAdapter dbAdapter=new DBAdapter(this,cursor);
list.setAdapter(dbAdapter);
}
list.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
cursor.moveToPosition(position);
String str=cursor.getString(cursor.getColumnIndex("name"));
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
}
});
}
public void mOnClick(View v){
Intent i = new Intent(this,test.class);
i.putExtra("message_text", cursor.getString(cursor.getColumnIndex("name")));
startActivity(i);
}
현재 리스트뷰의 텍스트뷰는 클릭하면 해당 디비가 나오는데
버튼은 어떻게 적용해야 할지 잘모르겠네요
텍스트뷰는 movetoposition(position)이걸 써서 위치값을 알아내는거 같은데 버튼에 적용하려고 이걸 전역변수로
적용해봤는데 잘안되네요