英文:
onStop for Fragment in TabLayout to save some content
问题
我有一个带有两个选项卡或片段的TabLayout。
在一个片段中,我想在切换选项卡或关闭应用程序之前保存例如来自编辑文本的文本。
我尝试使用onStop。它在关闭应用程序之前保存内容。但当我切换到第二个选项卡时,应用程序会关闭而没有异常。
为什么?这个问题有解决办法吗?
英文:
I have a TabLayout with two Tabs or Fragments.
In one Fragment I want to save for example text from edittext before switching tab or closing app.
I tried with onStop. It save the content before closing app. But when I go to second tab, the app closes without exception.
Why? Are the a solution for this problem?
专注分享java语言的经验与见解,让所有开发者获益!
评论