1

I am trying to attach a image file or bitmap while sending a direct message in android. Please help on the same.

Kantesh
  • 333
  • 4
  • 13

1 Answers1

0

See the link here... https://stackoverflow.com/a/12740436/3884250

 /** * To upload a picture with some piece of text. 
 * * * @param file The file which we want to share with our tweet 
 * @param message Message to display with picture 
 * @param twitter Instance of authorized Twitter class 
 * @throws Exception exception if any 


  */ public void uploadPic(File file, String message,Twitter twitter) throws Exception 
  { 
    try{ 
          StatusUpdate status = new StatusUpdate(message); 
          status.setMedia(file); 
          twitter.updateStatus(status);
     } catch(TwitterException e){ 
           Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; 
     }
  }
Community
  • 1
  • 1
Nadeem Iqbal
  • 2,357
  • 1
  • 28
  • 43