A Cursoris simply the result of a database with a position indicator in the current row. When you browse your list, and new lines are filled based on the cursor data, this position indicator automatically moves for you under the covers.
, bindView() , , TextViews , call_btn.onClick(), , , , , , , onClickListener bindView().
. bindView() , , onClick():
@Override
public void bindView(View view, Context context, final Cursor cursor) {
TextView tv1 = (TextView)view.findViewById(R.id.txt_name);
TextView tv2 = (TextView)view.findViewById(R.id.txt_numer);
tv1.setText(cursor.getString(2));
tv2.setText(cursor.getString(3));
final Button call_btn= (Button)view.findViewById(R.id.call_btn);
final int position = cursor.getPosition();
call_btn.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
cursor.moveToPosition(position);
Toast.makeText(b, cursor.getString(1), Toast.LENGTH_SHORT).show();
}});
}