How to send an image as a direct message with twitter in android?


I want to send an image with text to a follower using twitter4j. I am able to send a direct message like this:

twitter.sendDirectMessage(twitterID, message);

Now, I can't figure out how to send an image as direct message. I did this for posting a tweet, which works:

StatusUpdate status = new StatusUpdate(message);

So is it possible to send a image as direct message in twitter with the library twitter4j?

Thanks in advance.

First it's worth noting what Twitter4j does. It provides a good abstraction and bindings to Twitter's REST API in Java.

If you look at Twitter's Direct Message Endpoint you will see that it does not currently provide a way to "attach" an image when sending a direct message.

This has been confirmed at Twitter Developers forums before:

We have no announced plans yet for providing a media upload endpoint for direct messages.