public
void
onItemClick(AdapterView<?> parent, View v,
int
position,
long
id) {
v.findViewById(imageViewId).getDrawable();
}
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { final String mImagePath; mImagePath = path.get(arg2); File fl=new File(mImagePath); BitmapFactory.Options opt=new BitmapFactory.Options(); opt.inPreferredConfig=Config.RGB_565; opt.inPurgeable=true; opt.inSampleSize=1; opt.inInputShareable=true; try { FileInputStream fin=new FileInputStream(fl); BufferedInputStream bin=new BufferedInputStream(fin); Bitmap bm=BitmapFactory.decodeStream(bin,null,opt); ImageView iv=new ImageView(OrderActivity.this); iv.setImageBitmap(bm); iv.setMaxWidth(500); iv.setMaxHeight(500); AlertDialog.Builder builder = new Builder(OrderActivity.this); builder.setView(iv); builder.setPositiveButton("确定",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); WindowManager m = getWindowManager(); Display d = m.getDefaultDisplay(); WindowManager.LayoutParams p = getWindow().getAttributes(); p.height = (int) (d.getHeight() * 0.6); p.width = (int) (d.getWidth() * 0.8); alertDialog.getWindow().setAttributes(p); bin.close(); }catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; }