Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 可以使用twitter 4j将图像附加到直接消息吗?_Android_Twitter_Twitter4j - Fatal编程技术网

Android 可以使用twitter 4j将图像附加到直接消息吗?

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

我正在尝试附加一个图像文件或位图,同时在android中发送一条直接消息。 请提供相关帮助。

请查看此处的链接


在这里粘贴一些图片。这是一张图片,它不会直接发送。回答错了。这是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; 
     }
  }