我想选择所有检查箱。
这里是我的法典。
private class BaseAdpterSendToServer extends BaseAdapter{
String latti,calulationVal;
String longi;
String name;
public BaseAdpterSendToServer(Context context) {
layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return AndroidCamera.imagelistcount;
}
@Override
public Object getItem(int arg0) {
return arg0;
}
@Override
public long getItemId(int arg0) {
return arg0;
}
@Override
public View getView(int position, View convertView, ViewGroup arg2) {
viewHolder holder;
if(convertView==null){
holder = new viewHolder();
convertView =layoutInflater.inflate(R.layout.row_send_to_server, null);
holder.showImage = (ImageView)convertView.findViewById(R.id.imgView);
holder.txtCalulation = (TextView)convertView.findViewById(R.id.txtCalualtionVal);
holder.txtLatti = (TextView)convertView.findViewById(R.id.txtValLat);
holder.txtLongi = (TextView)convertView.findViewById(R.id.txtValLong);
holder.txtName = (TextView)convertView.findViewById(R.id.txtValName);
holder.checkBox = (CheckBox)convertView.findViewById(R.id.chkBox);
convertView.setTag(holder);
}
else{
holder =(viewHolder)convertView.getTag();
}
int pos = 0;
DBConnect d1 = new DBConnect(getApplicationContext(),"colorCode.db");
pos = position+1;
Cursor c = d1.selectedImageId(pos);
String path = c.getString(1);
calulationVal = c.getString(2);
String s= calulationVal.toString();
latti = c.getString(3);
longi = c.getString(4);
name = c.getString(5);
d1.close();
Bitmap b1 = BitmapFactory.decodeFile(path);
System.out.println("THE BITMAP ISK ----- "+b1);
holder.showImage.setImageBitmap(b1);
holder.txtCalulation.setText(""+s);
holder.txtLatti.setText(""+latti);
holder.txtLongi.setText(""+longi);
holder.txtName.setText(""+name);
bt_f_unsel.setOnClickListener(new OnClickListener() {
}
});
return convertView;
}
class viewHolder{
TextView txtCalulation ,txtLatti, txtLongi,txtName;
ImageView showImage;
CheckBox checkBox;
}
对我来说,任何帮助都是好的。