Store Drawable extracted from ImageView of another app(another developer’s) as a file, and send the file Uri.
contactDrawable = MyUtil.extractImage(context, root);
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Config.ARGB_8888);
drawable.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
if (drawable instanceof BitmapDrawable) {
bitmap = ((BitmapDrawable)drawable).getBitmap();
}
try {
String extStorageDirectory = Environment.getExternalStorageDirectory
().toString();
().toString();
File mDir = new File(extStorageDirectory + “/SW2Line/”);
if(!mDir.exists())
mDir.mkdir();
FileOutputStream out = new FileOutputStream(extStorageDirectory +
“/SW2Line/tempProfile.png”);
“/SW2Line/tempProfile.png”);
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
out.flush();
out.close();
contactIcon = Uri.fromFile(new File(extStorageDirectory +
“/SW2Line/tempProfile.png”)).toString();
“/SW2Line/tempProfile.png”)).toString();
LogControl.i(TAG,“out toString = “ + contactIcon );
} catch (Exception e) {
e.printStackTrace();
}
}catch(Exception e) {e.printStackTrace(); contactIcon = “”;}