I have a ViewPager and multiple tabs. One of these tabs controls the settings, which affects every other tabs. Everything updates itself perfectly fine when I change the settings, except for the pages that are kept in memory. In order to get these to update I have to select a tab far enough from it, then come back.

Is there a way to force these tabs to recreate themselves?

Thank you

有帮助吗?

解决方案

According to this question on SO, you can reset the adapter which will reload all the pages:

viewPage.setAdapter( adapter );

The duplicate that that question is linked to also gives some helpful information, such as calling .notifyDataSetChanged() on your ViewPager adapter.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top