listView1.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { Log.v("Module Item Trigger", "Module item was triggered"); //checkim is the byte array of the image to be passed to another activity or URL of the image whatever is best. Bundle bundle = new Bundle(); bundle.putByteArray("image", checkim); myintent.putExtras(bundle); startActivity(myintent); } }); //This is the API method for getting a image from the server it brings image in byte array and i add this to listview by making it as a bitmap. I want this image to be passed to another activity when pressed. @Override public void onBinaryMessage(byte[] image) { Bitmap receivedImage=BitmapFactory.decodeByteArray(image,0,image.length); float scale=1; int width = receivedImage.getWidth(); int height = receivedImage.getHeight(); float scaleHeight = (float)height/(float)200; float scaleWidth = (float)width /(float)200; if (scaleWidth < scaleHeight) {scale = scaleHeight;} else { scale = scaleWidth; } Bitmap bitmaped = Bitmap.createScaledBitmap(receivedImage, (int)(width/scale), (int)(height/scale), true); addImage(new Message(bitmaped,false,false)); } //Another image which is to be passed when clicked is from my photo gallery when selected and populated in the listview like this @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); Bitmap fileimage =BitmapFactory.decodeFile(picturePath); float scale=1; int width = fileimage.getWidth(); int height = fileimage.getHeight(); float scaleHeight = (float)height/(float)300; float scaleWidth = (float)width /(float)300; if (scaleWidth < scaleHeight) {scale = scaleHeight;} else { scale = scaleWidth; } Bitmap bitmap = Bitmap.createScaledBitmap(fileimage, (int)(width/scale), (int)(height/scale), true); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream); byte[] byteArray = stream.toByteArray(); //checkim=stream.toByteArray(); //System.out.println("checkim is instantiated"+checkim.toString()); mConnection.sendBinaryMessage(byteArray); addImage(new Message(bitmap,true,false)); } }