aboutsummaryrefslogtreecommitdiff
path: root/cashier
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-10-13 10:12:34 -0300
committerTorsten Grote <t@grobox.de>2020-10-13 10:12:34 -0300
commit85a3a53805ae47e753b05704dce77dcef06b3183 (patch)
tree5d6ade42af9498b1a6fdec458d8e3fcd5176e101 /cashier
parente9aae97e558c0f57479d5f827a0fc6b802bfee81 (diff)
downloadtaler-android-85a3a53805ae47e753b05704dce77dcef06b3183.tar.gz
taler-android-85a3a53805ae47e753b05704dce77dcef06b3183.tar.bz2
taler-android-85a3a53805ae47e753b05704dce77dcef06b3183.zip
[cashier] prevent crash while main fragment is on back-stack
and screen is rotated two times.
Diffstat (limited to 'cashier')
-rw-r--r--cashier/src/main/java/net/taler/cashier/BalanceFragment.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
index 1328484..002301c 100644
--- a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
+++ b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
@@ -53,7 +53,7 @@ class BalanceFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
+ savedInstanceState: Bundle?,
): View? {
setHasOptionsMenu(true)
ui = FragmentBalanceBinding.inflate(layoutInflater, container, false)
@@ -97,8 +97,9 @@ class BalanceFragment : Fragment() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
- // for some reason automatic restore isn't working at the moment!?
- ui.amountView.editText?.text.let {
+ // automatic restore isn't working, maybe because of the different layout in landscape mode
+ // the ui won't be available after onDestroyView()
+ if (view != null) ui.amountView.editText?.text.let {
outState.putCharSequence("amountView", it)
}
}