Android 可以使用twitter 4j将图像附加到直接消息吗?
我正在尝试附加一个图像文件或位图,同时在android中发送一条直接消息。 请提供相关帮助。请查看此处的链接Android 可以使用twitter 4j将图像附加到直接消息吗?,android,twitter,twitter4j,Android,Twitter,Twitter4j,我正在尝试附加一个图像文件或位图,同时在android中发送一条直接消息。 请提供相关帮助。请查看此处的链接 在这里粘贴一些图片。这是一张图片,它不会直接发送。回答错了。这是6年前的答案像我这样的人仍然会来这里,可能会让一些人感到困惑 /** * To upload a picture with some piece of text. * * * @param file The file which we want to share with our tweet * @param me
在这里粘贴一些图片。这是一张图片,它不会直接发送。回答错了。这是6年前的答案像我这样的人仍然会来这里,可能会让一些人感到困惑
/** * 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;
}
}