From 6c0c5ecc16d86998a7968a9797981a3f31bd7ca5 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 9 Dec 2018 13:31:36 +0000 Subject: [PATCH] reset_form: focus the description before removing extra rows potentially containing focused elements --- .../java/net/ktnx/mobileledger/NewTransactionActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java index 853fd0a6..754d57f4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java @@ -403,6 +403,9 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal private void reset_form() { text_date.setText(""); text_descr.setText(""); + + text_descr.requestFocus(); + while(table.getChildCount() > 2) { table.removeViewAt(2); } @@ -413,7 +416,5 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal ((TextView)tr.getChildAt(0)).setText(""); ((TextView)tr.getChildAt(1)).setText(""); } - - text_descr.requestFocus(); } } -- 2.39.5