0

我已经下载并替换了 socialauth-android-2.1.jar 当点击好友按钮时,无法获取推特好友列表。它抛出错误。

I got below error.
04-16 10:17:05.695: I/TwitterImpl(14690): Fetching contacts from http://api.twitter.com/1/friends/ids.json?screen_name=sgm_friends&cursor=-1
04-16 10:17:05.700: D/SocialAuthAdapter(14690): Contact list not Received
04-16 10:17:05.700: W/System.err(14690): org.brickred.socialauth.exception.SocialAuthException: Failed to retrieve the contacts from http://api.twitter.com/1/friends/ids.json?screen_name=sgm_friends&cursor=-1
04-16 10:17:05.700: W/System.err(14690):    at org.brickred.socialauth.provider.TwitterImpl.getContactList(TwitterImpl.java:287)
04-16 10:17:05.705: W/System.err(14690):    at org.brickred.socialauth.android.SocialAuthAdapter.getContactList(SocialAuthAdapter.java:688)
04-16 10:17:05.705: W/System.err(14690):    at org.brickred.customui.CustomUI.Events(CustomUI.java:199)
04-16 10:17:05.705: W/System.err(14690):    at org.brickred.customui.CustomUI$ResponseListener$1.onClick(CustomUI.java:137)
04-16 10:17:05.705: W/System.err(14690):    at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:934)
04-16 10:17:05.705: W/System.err(14690):    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
04-16 10:17:05.705: W/System.err(14690):    at android.widget.AbsListView.performItemClick(AbsListView.java:1283)
04-16 10:17:05.705: W/System.err(14690):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3074)
04-16 10:17:05.705: W/System.err(14690):    at android.widget.AbsListView$1.run(AbsListView.java:4147)
04-16 10:17:05.705: W/System.err(14690):    at android.os.Handler.handleCallback(Handler.java:615)
04-16 10:17:05.705: W/System.err(14690):    at android.os.Handler.dispatchMessage(Handler.java:92)
04-16 10:17:05.705: W/System.err(14690):    at android.os.Looper.loop(Looper.java:137)
04-16 10:17:05.705: W/System.err(14690):    at android.app.ActivityThread.main(ActivityThread.java:4898)
04-16 10:17:05.705: W/System.err(14690):    at java.lang.reflect.Method.invokeNative(Native Method)
04-16 10:17:05.710: W/System.err(14690):    at java.lang.reflect.Method.invoke(Method.java:511)
04-16 10:17:05.710: W/System.err(14690):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
04-16 10:17:05.710: W/System.err(14690):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
04-16 10:17:05.710: W/System.err(14690):    at dalvik.system.NativeStart.main(Native Method)
04-16 10:17:05.710: W/System.err(14690): Caused by: org.brickred.socialauth.exception.SocialAuthException: android.os.NetworkOnMainThreadException
04-16 10:17:05.710: W/System.err(14690):    at org.brickred.socialauth.util.HttpUtil.doHttpRequest(HttpUtil.java:154)
04-16 10:17:05.710: W/System.err(14690):    at org.brickred.socialauth.util.OAuthConsumer.send(OAuthConsumer.java:406)
04-16 10:17:05.710: W/System.err(14690):    at org.brickred.socialauth.util.OAuthConsumer.httpGet(OAuthConsumer.java:280)
04-16 10:17:05.710: W/System.err(14690):    at org.brickred.socialauth.oauthstrategy.OAuth1.executeFeed(OAuth1.java:121)
04-16 10:17:05.710: W/System.err(14690):    at org.brickred.socialauth.provider.TwitterImpl.getContactList(TwitterImpl.java:285)
04-16 10:17:05.710: W/System.err(14690):    ... 17 more
04-16 10:17:05.710: W/System.err(14690): Caused by: android.os.NetworkOnMainThreadException
04-16 10:17:05.715: W/System.err(14690):    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1118)
04-16 10:17:05.715: W/System.err(14690):    at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
04-16 10:17:05.715: W/System.err(14690):    at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
04-16 10:17:05.715: W/System.err(14690):    at java.net.InetAddress.getAllByName(InetAddress.java:214)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
04-16 10:17:05.715: W/System.err(14690):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
04-16 10:17:05.720: W/System.err(14690):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
04-16 10:17:05.720: W/System.err(14690):    at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
04-16 10:17:05.720: W/System.err(14690):    at org.brickred.socialauth.util.HttpUtil.doHttpRequest(HttpUtil.java:152)
04-16 10:17:05.720: W/System.err(14690):    ... 21 more

我在 5 天前在这里发帖。但没有回应。 https://code.google.com/p/socialauth-android/issues/detail?can=2&q=53&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&id=53

4

3 回答 3

1

社交身份验证人员在这里回答了问题https://code.google.com/p/socialauth-android/issues/detail?can=2&q=53&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&id=53

它们已针对异步请求进行了更改。我使用了较旧的实现,现在问题已解决。

于 2013-05-07T05:21:39.203 回答
0

ScreeName这可能会帮助您从Provide 喜欢中看到您的需要

HttpParameters params1 = mProvider.getResponseParameters();
String ScreeName = params1.getFirst("screen_name");

然后需要将此 ScreenName 传递给

https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name="+ScreeName

Here需要调用这个APIAsyncTask然后Response你到达那里是JsonArray

Ids 

你的好友ID

于 2013-04-20T04:34:19.503 回答
0

您还可以使用以下方式获取关注者和关注列表jtwitter.jar

    List<User> followers= twitter.getFollowers();
            for(int i=0;i<followers.size();i++)
            {
                User follower=followers.get(i);
                String name=follower.getName();
                Log.i("follower", name);
            }
            List<User> following = twitter.getFriends();
            for(int i=0;i<following.size();i++)
            {
                User user=following.get(i);
                String name=user.getName();
                Log.i("following", name);
            }
于 2013-04-20T05:05:40.040 回答