Dismiss keyboard between title & categorization fragment

The keyboard stays on, but the keys go to the wrong window
This commit is contained in:
YuviPanda 2013-03-31 03:20:11 +05:30
parent e936add26c
commit 02658588df
2 changed files with 14 additions and 1 deletions

View file

@ -83,7 +83,7 @@ public class MultipleUploadListFragment extends SherlockFragment {
public void onStop() {
super.onStop();
// FIXME: Stops the keyboard from being shown 'stale' while
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
View target = getView().findFocus();
if (target != null) {
InputMethodManager imm = (InputMethodManager) target.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

View file

@ -10,6 +10,7 @@ import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
@ -79,6 +80,18 @@ public class SingleUploadFragment extends SherlockFragment {
uploadActionInitiatedHandler = (OnUploadActionInitiated) activity;
}
@Override
public void onStop() {
super.onStop();
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
View target = getView().findFocus();
if (target != null) {
InputMethodManager imm = (InputMethodManager) target.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(target.getWindowToken(), 0);
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);