public void shareImage() {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
ArrayList<Uri> files = new ArrayList<Uri>();
//ClipboardManager obj = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
//ClipData clipData = null;
for(String imageName : selectdImages ) {
//File file = new File("android.resource://com.raj.pics/drawable/"+ getResources().getIdentifier(imageName, "drawable",getPackageName()));
Uri uri = Uri.parse("android.resource://com.raj.pics/drawable/"+ getResources().getIdentifier(imageName, "drawable",getPackageName()));
//clipData = ClipData.newUri(getContentResolver(), "Image", uri);
//obj.setPrimaryClip(clipData);
files.add(uri);
}
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
//shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "");
startActivity(Intent.createChooser(shareIntent, "Send your image"));
}
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
ArrayList<Uri> files = new ArrayList<Uri>();
//ClipboardManager obj = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
//ClipData clipData = null;
for(String imageName : selectdImages ) {
//File file = new File("android.resource://com.raj.pics/drawable/"+ getResources().getIdentifier(imageName, "drawable",getPackageName()));
Uri uri = Uri.parse("android.resource://com.raj.pics/drawable/"+ getResources().getIdentifier(imageName, "drawable",getPackageName()));
//clipData = ClipData.newUri(getContentResolver(), "Image", uri);
//obj.setPrimaryClip(clipData);
files.add(uri);
}
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
//shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "");
startActivity(Intent.createChooser(shareIntent, "Send your image"));
}
No comments:
Post a Comment