title: Sharing image from webview to whatsapp
body: <p>I have created an app which shows multiple webpages. I want that app to share image which is displayed on that webpage with whatsapp and other IM messengers, for that i have added a context menu and have implemented ACTION_SEND but it didn't work. When i try to share image it gives me error <em>"sharing failed please try again"</em> Here is my code</p>
  
  <pre><code>public class TopRatedFragment extends Fragment {
  private ProgressBar progress;
  private WebView myWebView2;
  private Menu optionsMenu;
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false);
  
  
      String url = "http://images.google.com";
      myWebView2 = (WebView) rootView.findViewById(R.id.webViewTop);
      myWebView2.setWebChromeClient(new myWebViewClient());
      myWebView2.getSettings().setJavaScriptEnabled(true);
      progress = (ProgressBar) rootView.findViewById(R.id.progressBar3);
      progress.setMax(100);
      setHasOptionsMenu(true);
      myWebView2.loadUrl(url);
  
  
      myWebView2.setWebViewClient(new WebViewClient() {
  
          @Override
          public boolean shouldOverrideUrlLoading(WebView View, String url) {
              View.loadUrl(url);
              TopRatedFragment.this.progress.setProgress(0);
              return true;
          }
      });
      myWebView2.setOnKeyListener(new android.view.View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              if (event.getAction() == KeyEvent.ACTION_DOWN) {
                  WebView webView = (WebView) v;
  
                  switch (keyCode) {
                      case KeyEvent.KEYCODE_BACK:
                          if (webView.canGoBack()) {
                              webView.goBack();
                              return true;
                          }
                          break;
                  }
              }
  
              return false;
          }
      });
      return rootView;
  
  }
  
  @Override
  public void onCreateOptionsMenu(
          Menu menu, MenuInflater inflater) {
      inflater.inflate(R.menu.menu_main, menu);
      optionsMenu = menu;
  }
  
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // handle item selection
      switch (item.getItemId()) {
          case R.id.airport_menuRefresh:
  
              TopRatedFragment.this.myWebView2.reload();
              setRefreshActionButtonState(true);
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
  {
      super.onCreateContextMenu(menu, v, menuInfo);
      menu.add(0, v.getId(), 0, "Call");
      menu.add(0, v.getId(), 0, "share image");
  }
  @Override
  public boolean onContextItemSelected(MenuItem item){
      if(item.getTitle()=="Call"){
          Toast.makeText(getActivity(), "calling code", Toast.LENGTH_LONG).show();
      }
      else if(item.getTitle()=="share image")
          {
  
         // This is the code which i am using for share intent
          Intent share = new Intent(android.content.Intent.ACTION_SEND);
          share.setType("image/*");
          share.putExtra(Intent.EXTRA_STREAM, Uri.parse(Environment.getExternalStorageState()));
          startActivity(Intent.createChooser(share, "Share image using"));
      }else{
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>Thanks for your help!</p>