From 0a4c9cda1dacb3541f17dbb8e097310a65555680 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 28 Dec 2015 21:52:23 +0100 Subject: Fix lifecycle bug --- .../openvpn/fragments/FileSelectionFragment.java | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'main') diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java index 3b146828..e3bcce41 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java @@ -57,6 +57,22 @@ public class FileSelectionFragment extends ListFragment { private boolean mHideImport = false; + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + onListItemClick(getListView(), view, position, id); + onFileSelectionClick(); + return true; + } + } + + ); + + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -95,17 +111,6 @@ public class FileSelectionFragment extends ListFragment { mClearButton.setEnabled(false); } - getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { - @Override - public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - onListItemClick(getListView(), view, position, id); - onFileSelectionClick(); - return true; - } - } - - ); - return v; } -- cgit v1.2.3