0

I'm trying to read the twitter public stream, I have used the twitter4j Java Library to do this.

The examples given in Sample Codes section "Streaming API" show that it should be coded like below

StatusListener listener = new MyStatusListener();
TwitterStream twitterStream = new TwitterStreamFactory(listener).getInstance();

Here the MyStatusListener implements the StatusListener interface. But I get error when creating the TwitterStreamFactory object (Cannot Resolve Constructor TwitterStreamFactory(twitter4j.Listener)), Have anyone come across this problem. Please comment any ideas

Proceso
  • 567
  • 1
  • 6
  • 24

1 Answers1

0

You are using TwitterStreamFactory incorrectly.

try this:

StatusListener listener = new MyStatusListener();
TwitterStream twitterStream = new TwitterStreamFactory().getInstance();
twitterStream.addListenter(listener);

you will also need to add a FilterQuery to the twitterStream instance

robthewolf
  • 7,343
  • 3
  • 29
  • 29
  • yeagh that worked :) Thank you verry much. I was just refering to the sample code given in twitter4j site and seems it's wrong. – Proceso Mar 08 '13 at 02:20