Initialise addButton early to avoid NPE.

This commit is contained in:
akwizgran
2018-09-28 16:23:59 +01:00
committed by Torsten Grote
parent 98add37b8d
commit 9fde41cc46

View File

@@ -79,6 +79,9 @@ public class ContactLinkExchangeFragment extends BaseFragment
int color = int color =
resolveColorAttribute(getContext(), R.attr.colorControlNormal); resolveColorAttribute(getContext(), R.attr.colorControlNormal);
addButton = v.findViewById(R.id.addButton);
addButton.setOnClickListener(view -> onAddButtonClicked());
contactNameInput = v.findViewById(R.id.contactNameInput); contactNameInput = v.findViewById(R.id.contactNameInput);
contactNameInput.addTextChangedListener(this); contactNameInput.addTextChangedListener(this);
if (SDK_INT < 23) { if (SDK_INT < 23) {
@@ -141,9 +144,6 @@ public class ContactLinkExchangeFragment extends BaseFragment
if (activity != null) activity.showCode(); if (activity != null) activity.showCode();
}); });
addButton = v.findViewById(R.id.addButton);
addButton.setOnClickListener(view -> onAddButtonClicked());
return v; return v;
} }