我想将推文发布给以下身份验证用户的用户。使用 Twitter-4j库进行身份验证。我已获取以下用户的列表(姓名和ID),但无法发布推文没有打开对话框。我遵循this link for aouth
问题 - 如何直接将推文发送给Android中的身份验证用户的以下用户,无需打开对话框
1。向朋友发送推文的代码
public void updateStatus() {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(TwitterConstants.CONSUMER_KEY);
builder.setOAuthConsumerSecret(TwitterConstants.CONSUMER_SECRET);
builder.setOAuthAccessToken(accessToken);
builder.setOAuthAccessTokenSecret(accessTokenSecret);
Configuration conf = builder.build();
Twitter twitter = new TwitterFactory(conf).getInstance();
System.out.println("in update status");
try {
// twitter.updateStatus("Hello World!");
StatusUpdate status = new StatusUpdate(messageToPost);
System.out.println("Length of Message is = = = "
+ messageToPost.trim().length());
System.out.println("App" + file);
status.setMedia(file);
System.out.println("App" + file.exists());
twitter.updateStatus(status);
System.out.println("App" + file);
} catch (TwitterException e) {
System.err.println("Error occurred while updating the status!");
e.printStackTrace();
}
}