From: Damyan Ivanov Date: Mon, 21 Jan 2019 19:38:59 +0000 (+0000) Subject: replace onClick XML declaration with a runtime hook X-Git-Tag: v0.3~5 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=86e2084b850138f76c159d38adebe99282d174de;p=mobile-ledger.git replace onClick XML declaration with a runtime hook fails in API 22 --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 1afc155d..f8bb6ce3 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -166,6 +166,8 @@ public class MainActivity extends AppCompatActivity { }); findViewById(R.id.btn_no_profiles_add).setOnClickListener(v -> startAddProfileActivity()); + + findViewById(R.id.btn_add_transaction).setOnClickListener(this::fabNewTransactionClicked); } @Override protected void onResume() { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7f01a1be..6ddb67e4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -51,7 +51,6 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" - android:onClick="fabNewTransactionClicked" app:backgroundTint="@color/colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"