@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)); } public void addImage(Message path) { messages.add(path); adapter.notifyDataSetChanged(); getListView().setSelection(messages.size()-1); v=(Vibrator) getSystemService(MainActivity.VIBRATOR_SERVICE); v.vibrate(200); } listView1.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { Log.v("Module Item Trigger", "Module item was triggered"); // String c = parent.getAdapter().getItem(position).toString(); String s; // ImageView im= (ImageView) view.findViewById(R.id.message_image); // s = ((TextView) view.findViewById(R.id.message_text)).getText().toString(); Bitmap bmp = ((ImageView) view.findViewById(R.id.message_image)).getDrawingCache(); ByteArrayOutputStream streamline = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 100, streamline); checkim=streamline.toByteArray(); Intent myintent=new Intent(MainActivity.this,ImageFull.class); Bundle bundle = new Bundle(); bundle.putByteArray("image", checkim); myintent.putExtras(bundle); startActivity(myintent); //TextView clickedView = (TextView) view; //Toast.makeText(MainActivity.this,"Byte array"+checkim.toString() , Toast.LENGTH_SHORT).show(); // Toast.makeText(getApplicationContext(),"this is ==>"+s,Toast.LENGTH_SHORT).show(); } });