D
D
Dauren S2017-01-06 06:55:31
Android
Dauren S, 2017-01-06 06:55:31

When you rotate the screen, the news disappears?

I created an Android application that parses json and displays it in a TabLayout. There are 3 tabs (ViewPager, Fragment ) and parsed news in them. Only when you turn the device over does the news fall. And the fragment becomes empty.
Here is what
No adapter attached; skipping layout
How to make news not disappear?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dauren S, 2017-01-06
@dauren101

In the
@Override snippet
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}

R
Rou1997, 2017-01-06
@Rou1997

Save state and reload saved in Fragment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question