Show twitter timeline using cloth: need to initialize cloth before using singleton ()

I want to display a timeline using a specific one screenName

I am getting this error: -

Must initialize fabric before using singleton ()

By the way, I am assuming to use automatic guest authentication. Here is my Java code: -

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);
    }
}

      

+3


source to share


2 answers


I decided to solve it myself. Just add below two lines. Don't forget to edit and paste your User Key (API Key) and User Secret (API Secret) .

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

      



before

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

      

+5


source


Add this Acitvity onCreate metod



Fabric.with(this, new Crashlytics());

      

+1


source







All Articles