我想使用特定的screenName显示时间轴,但出现此错误:-



顺便说一句,我想使用自动访客身份验证。这是我的Java代码:

import android.app.ListActivity;
import android.os.Bundle;

import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
import com.twitter.sdk.android.tweetui.UserTimeline;

public class TimelineActivity extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.timeline);

        final UserTimeline userTimeline = new UserTimeline.Builder()
                .screenName("fabric")
                .build(); //HERE I AM GETTING THIS ERROR
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter(this, userTimeline);
        setListAdapter(adapter);
    }
}

最佳答案

我自己解决了。只需添加以下两行即可。不要忘记编辑并粘贴使用者 key (API key )使用者 key (API key )

TwitterAuthConfig authConfig =  new TwitterAuthConfig("add your Consumer Key (API Key) ", "Consumer Secret (API Secret)");
Fabric.with(this, new TwitterCore(authConfig), new TweetUi());


final UserTimeline userTimeline = new UserTimeline.Builder().screenName("fabric").build()

10-07 19:26