Note that there are some explanatory texts on larger screens.

plurals
  1. POTo Get Twitter followers list
    text
    copied!<p>I am developing an Android app to get Twitter followers.The following code is used for authentication and I have logged in successfully.</p> <pre><code>consumer = new CommonsHttpOAuthConsumer( key, secret); CommonsHttpOAuthProvider provider = new CommonsHttpOAuthProvider( "http://twitter.com/oauth/request_token", "http://twitter.com/oauth/access_token", "http://twitter.com/oauth/authorize"); String authUrl = provider.retrieveRequestToken(consumer, TWITTER_CALLBACK_URL); Log.e("Twittwer ", "Please authorize this app!"); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl))); </code></pre> <p>In order to get the list of followers I have used the code below but I got error and the logcat is attached </p> <pre><code>AccessToken accessToken = new AccessToken(consumer.getToken(), consumer.getTokenSecret()); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(key); builder.setOAuthConsumerSecret(secret); Configuration conf = builder.build(); twitter = new TwitterFactory(conf).getInstance(); twitter.setOAuthAccessToken(accessToken); IDs followersId = twitter.getFollowersIDs(twitter.getId()); do { for (long i : followersId.getIDs()) { System.out.println("follower ID #" + i); System.out.println(twitter.showUser(i).getName()); System.out.println(twitter.showUser(i) .getProfileImageURL()); System.out.println(twitter.showUser(i).getURL()); } } while (followersId.hasNext()); } catch (TwitterException e) { System.out.println("e........"+e.getMessage()); e.printStackTrace(); } </code></pre> <p>logcat:</p> <pre><code>02-18 16:13:10.632: W/System.err(734): Received authentication challenge is null 02-18 16:13:10.682: W/System.err(734): Relevant discussions can be found on the Internet at: 02-18 16:13:10.682: W/System.err(734): http://www.google.co.jp/search?q=a1259409 or 02-18 16:13:10.702: W/System.err(734): http://www.google.co.jp/search?q=06b97274 02-18 16:13:10.712: W/System.err(734): TwitterException{exceptionCode=[a1259409-06b97274 2e9324ac-d074d7d2], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3} 02-18 16:13:10.752: W/System.err(734): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:192) 02-18 16:13:10.903: W/System.err(734): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61) 02-18 16:13:11.012: W/System.err(734): at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:89) 02-18 16:13:11.062: W/System.err(734): at twitter4j.TwitterBaseImpl.fillInIDAndScreenName(TwitterBaseImpl.java:126) 02-18 16:13:11.123: W/System.err(734): at twitter4j.TwitterBaseImpl.getId(TwitterBaseImpl.java:118) 02-18 16:13:11.142: W/System.err(734): at com.nest.twitterfriendsfinder.MainActivity$getFollowers.doInBackground(MainActivity.java:276) 02-18 16:13:11.152: W/System.err(734): at com.nest.twitterfriendsfinder.MainActivity$getFollowers.doInBackground(MainActivity.java:1) 02-18 16:13:11.192: W/System.err(734): at android.os.AsyncTask$2.call(AsyncTask.java:264) 02-18 16:13:11.212: W/System.err(734): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 02-18 16:13:11.232: W/System.err(734): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 02-18 16:13:11.302: W/System.err(734): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 02-18 16:13:11.362: W/System.err(734): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 02-18 16:13:11.362: W/System.err(734): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 02-18 16:13:11.362: W/System.err(734): at java.lang.Thread.run(Thread.java:856) 02-18 16:13:11.362: W/System.err(734): Caused by: java.io.IOException: Received authentication challenge is null 02-18 16:13:11.372: W/System.err(734): at libcore.net.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:397) 02-18 16:13:11.372: W/System.err(734): at libcore.net.http.HttpURLConnectionImpl.processResponseHeaders(HttpURLConnectionImpl.java:345) 02-18 16:13:11.372: W/System.err(734): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:276) 02-18 16:13:11.372: W/System.err(734): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479) 02-18 16:13:11.372: W/System.err(734): at twitter4j.internal.http.HttpResponseImpl.&lt;init&gt;(HttpResponseImpl.java:34) 02-18 16:13:11.382: W/System.err(734): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:156) </code></pre> <p>What is the issue in this code.I read in some post that to check the Timestamp in emulator.But time and date in emulator is correct.Please provide me some help.Thanks in advance..</p> <p>[EDIT] I <a href="https://stackoverflow.com/a/13042325/1767260">this</a> right?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload