I'm trying in a fragment to save a listView and restore it when I rotate the device. It works well except on Oreo.
Buttons show up but the list doesn't.
What is wrong with this approach?
I used onSavedinstance. Then static variables and I rebuild the list the way I do initially.
At runtime it does not complain. It seems that I'm missing a call to refresh the view. I get a blank screen in place of my ListView.
I can't find some oreo documentation that explains the way to deal with listview on device's rotation? or tuto/example? I use a List/adapter mechanism.
What has changed in Oreo?
from Oreo - issue when rotating a device within a fragment with a listView
Buttons show up but the list doesn't.
What is wrong with this approach?
I used onSavedinstance. Then static variables and I rebuild the list the way I do initially.
At runtime it does not complain. It seems that I'm missing a call to refresh the view. I get a blank screen in place of my ListView.
I can't find some oreo documentation that explains the way to deal with listview on device's rotation? or tuto/example? I use a List/adapter mechanism.
What has changed in Oreo?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
view = inflater.inflate(R.layout.test_frag, null);
if (savedInstanceState != null && listTest != null) {
Parcelable listViewState = savedInstanceState.getParcelable("listview.state");
listTest.onRestoreInstanceState(listViewState);
listTest.setVisibility(View.VISIBLE);
listTest.onRestoreInstanceState(listViewState);
}
return (view);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable("listview.state", listTest.onSaveInstanceState());
}
EDIT - this is my logcat output when I do the rotation:07-07 09:44:26.907 20115-20115/com.narb.test W/InputMethodManager: startInputReason = 4
07-07 09:44:26.918 20115-20148/com.narb.test W/libEGL: EGLNativeWindowType 0x79d74b8010 dis
connect failed
07-07 09:44:26.923 20115-20115/com.narb.test V/ActivityThread: Config is null for app:com.n
arb.test
07-07 09:44:26.932 20115-20115/com.narb.test D/HwCust: Create obj success use class android
.app.HwCustActivityImpl
07-07 09:44:26.934 20115-20115/com.narb.test V/ActivityThread: callActivityOnCreate
07-07 09:44:26.945 20115-20115/com.narb.test android.app.HwCustActivityImpl
07-07 09:44:27.000 20115-20115/com.narb.test W/ActionBarDrawerToggle: DrawerToggle may not
show
up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHome
AsUpEnabled(true);
07-07 09:44:27.010 20115-20115/com.narb.test D/CubicBezierInterpolator: CubicBezierInterpol
ator new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **,
egl_color_buffer_format *, EGLBoolean) returns 0x3000
07-07 09:44:27.201 20115-20148/com.narb.test D/OpenGLRenderer: HWUI Binary is enabled
07-07 09:44:27.240 20115-20115/com.narb.test W/InputMethodManager: startInputReason = 1
from Oreo - issue when rotating a device within a fragment with a listView
No comments:
Post a Comment