Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have done using following method. you can try this.</p> <p>//paramString="text you want to put in caption"</p> <pre><code>private void postPhotoTumblr(String uploadedImagePhotoUrl, String paramString) { CommonsHttpOAuthConsumer localCommonsHttpOAuthConsumer = getTumblrConsumer(); String str1 = "logged in username"; String encodedImage = uploadedImagePhotoUrl; DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(); HttpPost localHttpPost = new HttpPost("http://api.tumblr.com/v2/blog/" + str1 + ".tumblr.com/post"); try { ArrayList localArrayList = new ArrayList(); localArrayList.add(new BasicNameValuePair("type", "photo")); BasicNameValuePair localBasicNameValuePair = new BasicNameValuePair("caption", paramString); localArrayList.add(localBasicNameValuePair); localArrayList.add(new BasicNameValuePair("data",encodedImage)); UrlEncodedFormEntity localUrlEncodedFormEntity = new UrlEncodedFormEntity(localArrayList); localHttpPost.setEntity(localUrlEncodedFormEntity); localCommonsHttpOAuthConsumer.sign(localHttpPost); InputStream localInputStream = localDefaultHttpClient.execute(localHttpPost).getEntity().getContent(); InputStreamReader localInputStreamReader = new InputStreamReader(localInputStream); BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader); StringBuilder localStringBuilder = new StringBuilder(); while (true) { String str2 = localBufferedReader.readLine(); if (str2 == null) { Log.i("DATA post resp", localStringBuilder.toString()); break; } localStringBuilder.append(str2); } } catch (ClientProtocolException localClientProtocolException) { localClientProtocolException.printStackTrace(); } catch (IOException localIOException) { localIOException.printStackTrace(); } catch (OAuthMessageSignerException localOAuthMessageSignerException) { localOAuthMessageSignerException.printStackTrace(); } catch (OAuthExpectationFailedException localOAuthExpectationFailedException) { localOAuthExpectationFailedException.printStackTrace(); } catch (OAuthCommunicationException localOAuthCommunicationException) { localOAuthCommunicationException.printStackTrace(); } } </code></pre> <p>EDIT : First Upload image to Web Server then get Url and try to Post with uploaded Url or File path. it will work fine sure... :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload