My application starts with a bunch of text input fields, and I want that when starting up the the application. The virtual keyboard isn't open, but opens only when I click on one of the textinput fields. How do I do this?
            Asked
            
        
        
            Active
            
        
            Viewed 515 times
        
    3 Answers
3
            
            
        In your onCreate method you could get your first text view and call requestFocus() on it. This ought to focus this field when the activity starts and bring up a virtual keyboard if needed.
If you want the keyboard not to appear on startup, request focus for a non-text element like a button.
 
    
    
        Nick
        
- 11,475
- 1
- 36
- 47
- 
                    Sorry, your question was unclear. Do you have any other focusable elements in your application such as a button? Set one of those to focus instead. – Nick Nov 14 '10 at 15:28
1
            
            
        You should leave the input method to the user. They might be using a physical keyboard or maybe even something like speech to text.
 
    
    
        JOTN
        
- 6,120
- 2
- 26
- 31
- 
                    i dont want to get the keyboard to appear ... iwant the keyboard to NOT appear – user434885 Nov 13 '10 at 16:56
- 
                    In that case just don't present an editable field. There's not much reason to have one if you want to block the input method. – JOTN Nov 14 '10 at 21:50
0
            
            
        I've used this approach to hide the keyboard after the user searches. You could use this in our onCreate method:
Close/hide the Android Soft Keyboard
Quote from Reto Meier's accepted solution:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
 
    
    
        Community
        
- 1
- 1
 
    
    
        Computerish
        
- 9,590
- 7
- 38
- 49
 
    