Skip to content Skip to sidebar Skip to footer

How To Share Image And Text On Pinterest Using Intent

I want to share image and text on pinterest using intent. Any ideas?

Solution 1:

You have to first check pintrest application is installed into device or not using this function.

    private boolean appInstalledOrNot(String uri) {
       PackageManager pm = getPackageManager();
       boolean app_installed;
       try {
           pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
           app_installed = true;
       }
       catch (PackageManager.NameNotFoundException e) {
           app_installed = false;
       }
       return app_installed;
   }

If this function returns you true than you can call this below line.

File imageFileToShare = new File(orgimagefilePath);

Uri uri = Uri.fromFile(imageFileToShare);

Intent sharePintrestIntent = new Intent(Intent.ACTION_SEND);
sharePintrestIntent.setPackage("com.pinterest");
sharePintrestIntent.putExtra("com.pinterest.EXTRA_DESCRIPTION", text);
sharePintrestIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharePintrestIntent.setType("image/*");
startActivityForResult(sharePintrestIntent, PINTEREST);

This was work for me. please check it.


Post a Comment for "How To Share Image And Text On Pinterest Using Intent"