Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- holder.shareBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Intent intent;
- Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), holder.imgView.getId());
- String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) +"/share.png";
- FileOutputStream out = null;
- File file = new File(path);
- try{
- out = new FileOutputStream(file);
- bitmap.compress(Bitmap.CompressFormat.PNG,100,out);
- out.flush();
- out.close();
- }catch(Exception e){
- e.printStackTrace();
- }
- path = file.getPath();
- Uri bmpUri = Uri.parse("file://" + path);
- intent = new Intent(Intent.ACTION_SEND);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(Intent.EXTRA_STREAM, bmpUri);
- intent.setType("image/jpeg");
- intent.putExtra(Intent.EXTRA_TEXT," Hello Your's Images ");
- context.startActivity(Intent.createChooser(intent, " Share Images Via"));
- }
Add Comment
Please, Sign In to add comment