Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/396.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
Java 使用Twitter4j发布twitter线程_Java_Twitter_Twitter4j - Fatal编程技术网

Java 使用Twitter4j发布twitter线程

Java 使用Twitter4j发布twitter线程,java,twitter,twitter4j,Java,Twitter,Twitter4j,我想知道如何使用Twitter4J发布Twitter4J的tweet线程。我猜它会以某种方式使用StatusUpdate类,但是文档有点稀疏。有任何提示吗?您应该将inReplyToStatusId设置为第一条tweet之后的每条tweet的最新发布状态id。inReplyToStatusId的默认值为-1 例如: long inReplyToStatusId = -1 int counter = 0 int threadLimit = 5 while (counter < thread

我想知道如何使用Twitter4J发布Twitter4J的tweet线程。我猜它会以某种方式使用
StatusUpdate
类,但是文档有点稀疏。有任何提示吗?

您应该将inReplyToStatusId设置为第一条tweet之后的每条tweet的最新发布状态id。inReplyToStatusId的默认值为-1

例如:

long inReplyToStatusId = -1
int counter = 0
int threadLimit = 5

while (counter < threadLimit){
    StatusUpdate statusUpdate = new StatusUpdate(Integer.toString(counter));
    statusUpdate.setInReplyToStatusId(inReplyToStatusId);

    Status updatedStatus = twitter.updateStatus(statusUpdate);
    inReplyToStatusId = updatedStatus.getId();
    counter++;
}
long inReplyToStatusId=-1
整数计数器=0
int threadLimit=5
while(计数器
对于第一条tweet之后的每条tweet,您应该将inReplyToStatusId设置为最新发布的状态id。inReplyToStatusId的默认值为-1

例如:

long inReplyToStatusId = -1
int counter = 0
int threadLimit = 5

while (counter < threadLimit){
    StatusUpdate statusUpdate = new StatusUpdate(Integer.toString(counter));
    statusUpdate.setInReplyToStatusId(inReplyToStatusId);

    Status updatedStatus = twitter.updateStatus(statusUpdate);
    inReplyToStatusId = updatedStatus.getId();
    counter++;
}
long inReplyToStatusId=-1
整数计数器=0
int threadLimit=5
while(计数器
只是一个快速打字更正:
lastPostedStatusId
应该是
inReplyToStatusId
只是一个快速打字更正:
lastPostedStatusId
应该是
inReplyToStatusId