我正在尝试使用以下代码获取Android中所有关注者的列表。
final long lCursor = -1;
new Thread(new Runnable()
{
@Override
public void run()
{
try{
IDs followersIDs = twitter.getFollowersIDs(UserID, lCursor);
do {
for (long i : followersIDs.getIDs()){
Log.d("follower ID #", String.valueOf(i));
}
}while(followersIDs.hasNext());
} catch (TwitterException e) {
Log.i("fetchFollowers", e.getErrorMessage());
}
}).start();
但获得空指针异常
答案 0 :(得分:0)
IDs followersIds;
long lCursor = -1;
do {
followersIds=twitter.getFollowersIDs(TwaccessToken.getUserId(), lCursor);
}while ((lCursor = followersIds.getNextCursor()) != 0);
do
{
for (long i : followersIds.getIDs())
{
contactid .add(twitter.showUser(i).getId()+"");
nameList.add( twitter.showUser(i).getName());
profileimageUrl.add(twitter.showUser(i).getProfileImageURL());
}
}while(followersIds.hasNext());