[Android] SearchFragment: give the focus to the search input on Android 2.3

Ludovic Fauvet git at videolan.org
Mon Apr 14 19:26:16 CEST 2014


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Apr 14 19:08:19 2014 +0200| [50be7dab2d1bd2be8e5ecc51b9f74c4025a3887e] | committer: Ludovic Fauvet

SearchFragment: give the focus to the search input on Android 2.3

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=50be7dab2d1bd2be8e5ecc51b9f74c4025a3887e
---

 vlc-android/src/org/videolan/vlc/gui/SearchFragment.java |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
index 563b66a..eded762 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
@@ -78,14 +78,14 @@ public class SearchFragment extends SherlockListFragment {
         mSearchText = (EditText) v.findViewById(R.id.search_text);
         mSearchText.setOnEditorActionListener(searchTextListener);
         mSearchText.addTextChangedListener(searchTextWatcher);
-
-        mSearchText.requestFocus();
     }
 
     @Override
     public void onResume() {
         super.onResume();
 
+        mSearchText.requestFocus();
+
         InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
         imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
         showSearchHistory();



More information about the Android mailing list