2010-08-15 4 views
1

내 액티비티가로드되면, txtEdit EditText 위젯이 포커스를 얻고 키보드를 보여주기를 바랍니다.안드로이드 폼 EditText Show 키보드 onResume

나는 이것을 onResume()에서 시도했지만 자동으로 표시하지는 않는다.

@Override 
protected void onResume() { 
    InputMethodManager mgr = (InputMethodManager) 
     getSystemService(Context.INPUT_METHOD_SERVICE); 
    mgr.showSoftInput(txtSearch, InputMethodManager.SHOW_IMPLICIT); 

답변

0

이 나를 위해 일한 :

@Override 
public void onResume() { 
    super.onResume(); 

    if (mFirstTime) { 

     new Handler().postDelayed(new Runnable() { 

      @Override 
      public void run() { 

       mAdapter.prepareFocus(); // request the focus and show the softkeyboard here 

      } 

     }, 100); 

    } 

    mFirstTime = false; 

}