I am trying to make an app with a twitter timeline an android studio. To do this I am using the twitter fabric API. The documentation for that I am following is found at https://docs.fabric.io/android/twitter/show-timelines.html#timeline-builders. The problem I am having is that the setListAdapter in setListAdapter(adapter); is coming up with an error saying "cannot resolve method 'setListAdapter(com.twitter.sdk.tweetui.TweetTimelineListAdapter)'". I really have no experience with android studio, so I've copied and pasted most of this code. I've looked up how adapters work in android studio, and I get what they do, but I'm not sure how they're set up. Thanks in advance for the help!
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.widget.SwipeRefreshLayout;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.models.Tweet;
import com.twitter.sdk.android.tweetui.SearchTimeline;
import com.twitter.sdk.android.tweetui.TimelineResult;
import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
import com.twitter.sdk.android.tweetui.UserTimeline;
import com.twitter.sdk.android.tweetui.CollectionTimeline;
public class FeedActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed);
final SwipeRefreshLayout swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
final SearchTimeline timeline = new SearchTimeline.Builder()
.query("#fblaoutfit")
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
.setTimeline(timeline)
.build();
setListAdapter(adapter);
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeLayout.setRefreshing(true);
adapter.refresh(new Callback<TimelineResult<Tweet>>() {
@Override
public void success(Result<TimelineResult<Tweet>> result) {
swipeLayout.setRefreshing(false);
}
@Override
public void failure(TwitterException exception) {
// Toast or some other action
}
});
}
});
}
Here's the XML if it will help you at all:
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="No Tweets"/>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#e1e8ed"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"/>
</android.support.v4.widget.SwipeRefreshLayout>