我正在从服务器数据库中获取项目名称、项目图像、价格和 desc 到自定义 lisview 中的 android 手机。我在自定义列表视图中放置了复选框。我在自定义列表视图中选择了一些项目。现在我想将那些选定的项目图像显示到另一个页面..请给出解决方案
i try this code
public class test extends BaseAdapter {
public Context Context;
String qrimage;
Bitmap bmp, resizedbitmap;
Bitmap[] bmps;
Activity activity = null;
private LayoutInflater inflater;
private ImageView[] mImages;
String[] itemimage;
TextView[] tv;
String itemname,price,desc;
String[] itemnames;
String[] prices;
String[] descs;
HashMap<String, String> map = new HashMap<String, String>();
public Appetizerlist(Context context, JSONArray imageArrayJson) {
Context=context;
//inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// imageLoader=new ImageLoader(activity);
inflater=LayoutInflater.from(context);
this.mImages = new ImageView[imageArrayJson.length()];
this.bmps = new Bitmap[imageArrayJson.length()];
this.itemnames = new String[imageArrayJson.length()];
this.prices=new String[imageArrayJson.length()];
this.descs=new String[imageArrayJson.length()];
try {
for (int i = 0; i < imageArrayJson.length(); i++) {
JSONObject image = imageArrayJson.getJSONObject(i);
qrimage = image.getString("itemimage");
itemname = image.getString("itemname");
price=image.getString("price");
desc=image.getString("itemdesc");
itemnames[i] = itemname;
prices[i]=price;
descs[i]=desc;
byte[] qrimageBytes = Base64.decode(qrimage.getBytes());
bmp = BitmapFactory.decodeByteArray(qrimageBytes, 0,
qrimageBytes.length);
int width = 100;
int height = 100;
resizedbitmap = Bitmap.createScaledBitmap(bmp, width, height,
true);
bmps[i] = bmp;
mImages[i] = new ImageView(context);
mImages[i].setImageBitmap(resizedbitmap);
mImages[i].setScaleType(ImageView.ScaleType.FIT_START);
// tv[i].setText(itemname);
}
System.out.println(map);
} catch (Exception e) {
// TODO: handle exception
}
}
public int getCount() {
return mImages.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
final ViewHolder viewHolder;
if (view == null) {
view = inflater.inflate(R.layout.appetiserlistview, null);
viewHolder = new ViewHolder();
viewHolder.image=(ImageView)view.findViewById(R.id.appetiserimage);
viewHolder.text = (TextView) view.findViewById(R.id.appetisertext);
viewHolder.desc=(TextView)view.findViewById(R.id.appetiserdesc);
viewHolder.price=(TextView)view.findViewById(R.id.appetiserdesc);
viewHolder.checkbox = (CheckBox) view.findViewById(R.id.bcheck);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
viewHolder.image.setImageBitmap(bmps[position]);
viewHolder.price.setText(prices[position]);
viewHolder.desc.setText(descs[position]);
viewHolder.checkbox.setTag(itemnames[position]);
ViewHolder holder = (ViewHolder) view.getTag();
holder.text.setText(itemnames[position]);
return view;
}
static class ViewHolder {
protected TextView text,price,desc;
protected ImageView image;
protected CheckBox checkbox;
}
}
我想将所选项目图像显示到下一页..请帮帮我