2016-11-12 7 views
0

インテントを使用してpinterest上でイメージとテキストを共有したいと考えています。何か案は?インテントを使用してpinterest上でイメージとテキストを共有する方法

+0

このタスクの新規デベロッパーです。私はインテントタイプをイメージとして設定しようとしましたが、pinterestでイメージリンクを共有するテストのために静的なWebイメージURLを設定しました。 – mehul

+0

これを試すhttps://stackoverflow.com/questions/38759057/share-score-on-facebook-android – sushildlh

+0

私はこのリンクをチェックしているが、これはFacebookの共有オプションのためだと思う。 – mehul

答えて

4

まず、pintrestアプリケーションがデバイスにインストールされているかどうか、またはこの機能を使用していないことを確認する必要があります。

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; 
    } 

この関数をtrueに戻す場合は、これを以下の行で呼び出すことができます。

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); 

これは私の仕事でした。これをチェックしてください。

+0

デバイスにPinterestアプリがインストールされていないとどうなりますか?このコードはその特定のシナリオで動作しますか? –

+0

いいえ 'activityNotFound'を返すので、まずアプリケーションがインストールされているかどうかを確認する必要があります。 –

+0

さて、それを得ました。あなたはpinterestアプリなしでpinterestを共有する方法を知っていますか? –

関連する問題