2014-11-15 3 views
0

오전 내 앱에 twitter4j를 사용하고 있습니다. twitter4j를 사용하여 미디어/텍스트를 게시 할 수 있습니다. 하지만 나는 내 신분의 이드를 원해.twitter4j tweeted id를 얻으려면

The method getId() is undefined for the type StatusUpdate 

나는 그래서 난 상태 StatusUpdate 교체 한

StatusUpdate status = new StatusUpdate(mfinalmsg); 

      if (imgdata != null) { 
       ByteArrayInputStream bis = new ByteArrayInputStream(imgdata); 

       status.setMedia("pic", bis); 

      } 

      twitter.updateStatus(status); 
      long statusId = (int)status.getId(); 

를 사용하여 피곤합니다. 하지만 어떻게 미디어/urllink를 업로드 할 수 있습니다.

twitter4j.Status status = twitter.updateStatus(mfinalmsg); 
      long statusId = (int)status.getId(); 

나는 twitter rest api를 사용할 준비가되었습니다. 하지만 params를 보내는 방법을 모른다. 제발 날 안내해주세요.

답변

1
StatusUpdate statusUpdate = new StatusUpdate(mfinalmsg); 

if (imgdata != null) { 
    ByteArrayInputStream bis = new ByteArrayInputStream(imgdata);  
    statusUpdate.setMedia("pic", bis); 
} 

Status status = twitter.updateStatus(statusUpdate); 
long statusId = (int)status.getId(); 

twitter.updateStatus() 메서드는 상태 개체를 반환합니다. 이 객체를 사용하여 StatusUpdate 클래스의 객체가 아닌 ID를 가져옵니다.

관련 문제