I'm taking snapshots and creat thumbnails and then share this image. But the thumbnail shows all black. I have used the following code
Bitmap bitmap;
View v1 = v.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
String url = Images.Media.insertImage(
mContext.getContentResolver(), bitmap, "title", null);
Can anyone tell me what is wrong with this code.
EDIT
private View.OnClickListener shareListener = new View.OnClickListener() {
public void onClick(View v) {
Bitmap bitmap;
View v1 = v.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
String url = Images.Media.insertImage(
mContext.getContentResolver(), bitmap, "title", null);
v1.setDrawingCacheEnabled(false);
Activity activity = (Activity) getContext();
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
activity.startActivity(Intent.createChooser(share,
"Share"));
}
};
Black Image
Try applying this code:
This works perfectly for me. Hope this will help you.
Use following code it may work for you. Thanks
Maybe this happens because your area is marked as secure. While the icons are shown, the view displaying your contents displays black because it's secure:
http://developer.android.com/reference/android/view/Display.html#FLAG_SECURE
try
Try this code.. It should be work.