Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change the bitmap URI code to content scheme? #50

Open
LOG-TAG opened this issue Jul 28, 2018 · 0 comments
Open

how to change the bitmap URI code to content scheme? #50

LOG-TAG opened this issue Jul 28, 2018 · 0 comments

Comments

@LOG-TAG
Copy link

LOG-TAG commented Jul 28, 2018

        Picasso.with(getActivity()).load(cardata.getImage()).into(new Target() {
                                @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
//                                    Intent i = new Intent(Intent.ACTION_SEND);
//                                    i.setType("image/*");
//                                    i.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap));
//                                    startActivity(Intent.createChooser(i, "Share Image"));

                                    IntentShare.with(getActivity())
                                            .chooserTitle("Share ")
                                            .text("test")
                                            .image(getLocalBitmapUri(bitmap))
                                            .mailSubject("Test")
                                            .mailBody("Test")
                                            .deliver();
                                }
                                @Override public void onBitmapFailed(Drawable errorDrawable) { }
                                @Override public void onPrepareLoad(Drawable placeHolderDrawable) { }
                            });

    public Uri getLocalBitmapUri(Bitmap bmp) {
        Uri bmpUri = null;
        try {
            File file = new File(getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png");
            FileOutputStream out = new FileOutputStream(file);
            bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
            out.close();
            bmpUri = Uri.fromFile(file);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return bmpUri;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant