title: how to share image on linkedin from android
body: <p>I've integrated the linked in <strong>text</strong> share successfully now i want to share <strong>image with text</strong>,images maybe get either from <strong>sdcard or image URL</strong>. How can i achieve that please provide me some solution.</p>
  
  <p>Here how i shared the linked in text,</p>
  
  <pre><code>share.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
          String share = et.getText().toString();
          if (null != share &amp;&amp; !share.equalsIgnoreCase("")) {
  
              OAuthConsumer consumer = new CommonsHttpOAuthConsumer(Config.LINKEDIN_CONSUMER_KEY, Config.LINKEDIN_CONSUMER_SECRET);
              consumer.setTokenWithSecret(accessToken.getToken(), accessToken.getTokenSecret());
  
              DefaultHttpClient httpclient = new DefaultHttpClient();
              HttpPost post = new HttpPost("https://api.linkedin.com/v1/people/~/shares");
              try {
                  consumer.sign(post);
              } catch (OAuthMessageSignerException e) {
                  e.printStackTrace();
              } catch (OAuthExpectationFailedException e) {
                  e.printStackTrace();
              } catch (OAuthCommunicationException e) {
                  e.printStackTrace();
              } // here need the consumer for sign in for post the share
              post.setHeader("content-type", "text/XML");
              String myEntity = "&lt;share&gt;&lt;comment&gt;"+ share +"&lt;/comment&gt;&lt;visibility&gt;&lt;code&gt;anyone&lt;/code&gt;&lt;/visibility&gt;&lt;/share&gt;";
              try {
                  post.setEntity(new StringEntity(myEntity));
                  org.apache.http.HttpResponse response = httpclient.execute(post);
                  Toast.makeText(LinkedInSampleActivity.this,
                          "Shared sucessfully", Toast.LENGTH_SHORT).show();
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
              } catch (ClientProtocolException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }else {
              Toast.makeText(LinkedInSampleActivity.this,
                      "Please enter the text to share",
                      Toast.LENGTH_SHORT).show();
          }
      }
  });
  }
  </code></pre>