Hello,
I’ve implemented Twitter’s SearchTimeline in my Android app few months ago and it was working like a charm.
But since a week (maybe more), the *TweetTimelineRecyclerViewAdapter with my SearchTimeline is freezing my app (and my phone, an s8+) on its first build.
I mean, when i launch my application, then click on my button to start my TweetsActivity, my phone is freezing on a black screen for like 5-10 seconds.
Finally, the activity appears with the timeline correctly displaying.
When i go back to the applications HomeActivity and then restart my TweetsActivity, this time its working perfectly, without any delay …
It’s really annoying as it’s supposed to be in a release of a new version of the app in few days (500k users …)
Some part of my code related to this issue:
public class TweetsActivity extends AppCompatActivity implements OnRefreshListener {
@BindView(R.id.recycler_view)
RecyclerView mRecyclerView;
@BindView(R.id.swipe_refresh)
SmartRefreshLayout mSwipeRefresh;
@Override
protected void onCreate(Bundle savedInstanceState) {
overridePendingTransition(R.anim.slide_in_bottom, R.anim.stay);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tweets);
ButterKnife.bind(this);
mSwipeRefresh.setOnRefreshListener(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
}
@Override
protected void onStart() {
super.onStart();
request();
}
** SOME CODE **
private void request() {
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query("#oklmradio OR @oklmradio OR oklmradio OR \"oklm radio\"")
.maxItemsPerRequest(20)
.build();
final TweetTimelineRecyclerViewAdapter mAdapter =
new TweetTimelineRecyclerViewAdapter.Builder(TweetsActivity.this)
.setTimeline(searchTimeline)
.setViewStyle(R.style.tw__TweetLightWithActionsStyle)
.build();
mRecyclerView.setAdapter(mAdapter);
}
}
In my app file:
private void setUpTwitter() {
TwitterConfig config = new TwitterConfig.Builder(this)
.twitterAuthConfig(new TwitterAuthConfig(getString(R.string.twitter_consumer_key),
getString(R.string.twitter_consumer_secret)))
.build();
Twitter.initialize(config);
}
Can you help me with this issue ?
Thank you in advance.
Fab