Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had use this for sending image to another user:</p> <p>On button click:</p> <pre><code> btn_transfer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent takePic = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(takePic, LOAD_IMAGE_GALLERY); } }); </code></pre> <p>ActivityForResult: </p> <pre><code> protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == LOAD_IMAGE_GALLERY &amp;&amp; resultCode == RESULT_OK &amp;&amp; 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]); picturePath = cursor.getString(columnIndex); cursor.close(); try { exifMedia = new ExifInterface(picturePath); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String exifOrint = exifMedia.getAttribute(ExifInterface.TAG_ORIENTATION); int exifOrientation = Integer.parseInt(exifOrint); System.out.println("Orientation Tag is:"+exifOrientation); System.out.println("Path Of the Image " + picturePath); BitmapFactory.Options mOptions=new BitmapFactory.Options(); mOptions.inSampleSize=2; Bitmap imgBitmap = BitmapFactory.decodeFile(picturePath,mOptions); Runtime.getRuntime().gc(); imgBitmap = MyProfileActivity.getResizedBitmapImage(imgBitmap, 60, 60, exifOrientation); MessageImageBitmap msgImgBitmap = new MessageImageBitmap(); msgImgBitmap.setImgBitmap(imgBitmap); msgImgBitmap.setImgPath(picturePath); MessagePacket packetMsg = new MessagePacket(); packetMsg.setMsgBitmap(msgImgBitmap); packetMsg.setIsSendPacket(true); packetMsg.setMessageType(MessagePacket.MESSAGE_TYPE_IMAGE); packetMsg.setIMAGE_PATH(picturePath); messageWithImage.add(packetMsg); customAdapter1.notifyDataSetChanged(); mList.setSelection(mList.getCount()); String to = frienduserID; dbhHelper.insertMessage(CCMStaticVariable.loginUserId + "@ec.abc.com", refineFromjId(to), "", "true", picturePath, 1); sendFile(picturePath, frienduserID); } } </code></pre> <p>This works for me.I am giving you my raw code but you can change it accordingly. Let me know if this helps you. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload