You can override onSaveInstanceState
and onRestoreInstanceState
to avoid downloading same tweets again.
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putSerializable(<Key>, <Value>);
super.onSaveInstanceState(savedInstanceState);
}
When the orientation is changed, restore the saved tweets.
[Edit]
Alternatively, you can do it without overriding onRestoreInstanceState
:
public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState!= null) {
value = savedInstanceState.getSerializable(<Key>);
}
}
More information here.