Search code examples
androidandroid-layouttwitterandroid-twitter

How to upload Image and tweet the message without using TweetPic for twitter?


In my application i am using tweetPic to uploaded image but with the image is only able to see on the tweetPic. Instead of that i want to upload the picture on the twitter and also with the custom message. So how it is possible? Twitter OAuth is also required for that.

I want any demo or sample example app that done like that.

Thanks.


Solution

  • Well i have search many but still not get the answer as i want.

    Finally i use this to upload the photo on Twitter with the Custom Message:

    File picture = new File(APP_FILE_PATH + "/"+filename+".jpg");  
       // Create TwitPic object and allocate TwitPicResponse object 
       TwitPic tpRequest = new TwitPic(TWITTER_NAME, TWITTER_PASSWORD); 
       TwitPicResponse tpResponse = null;  
       // Make request and handle exceptions                            
       try {         
         tpResponse = tpRequest.uploadAndPost(picture, customMessageEditText.getText()+" http://www.MySite.com/");
    
       } 
       catch (IOException e) {         
          e.printStackTrace(); 
       } 
       catch (TwitPicException e) {         
       e.printStackTrace(); 
       }  
       // If we got a response back, print out response variables                               
       if(tpResponse != null) {         
          tpResponse.dumpVars();
          System.out.println(tpResponse.getStatus());
          if(tpResponse.getStatus().equals("ok")){
    
          Toast.makeText(getApplicationContext(), "Photo posted on Twitter.",Toast.LENGTH_SHORT).show();
    
       }
     }
    

    Still in search of the Twitter Demo to tweet pics on the Twitter with custom message with twitter OAuth and Without using twitPic.

    Enjoy. :)

    Thanks.