Retrieve tweets' language or filter them by language with TwitterStream


#1

I would like to retrieve or filter by language using TwitterStream class. I want to get only tweets of one language or otherwise retrieve everything and then identify each tweet language.

I have build this code but getIsoLanguageCode() returns null always (version 3.0.4, http://twitter4j.org/oldjavadocs/3.0.4-SNAPSHOT/twitter4j/Status.html), I think there is any problem with this method.

TwitterStream twitterStream = TwitterPrintRandomStream.createTwitterConnection();
StatusListener listener = new StatusListener() {

        public void onStatus(Status status) {
           String tw =  status.getText() + " " + status.getIsoLanguageCode();
           System.out.println(tw);
        }


}
I also tried the method Status.getUser().getLang() but it returns the user’s language not the tweet. Are there any way to do it?

Thanks in advance.