i have the value like WORK but i want to set this to edit text like Work. Can anybody help me out?
            Asked
            
        
        
            Active
            
        
            Viewed 97 times
        
    -2
            
            
        - 
                    check my updated ans – AskNilesh Jun 12 '17 at 10:21
3 Answers
1
            
            
        try this
<EditText
    android:id="@+id/txtCapitalize"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:inputType="textCapSentences" />
EditText txtCapitalize = (EditText) findViewById(R.id.txtCapitalize);
    txtCapitalize.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
or android:inputType="textCapSentences" will only work If your device keyboard Auto Capitalize Setting enabled.
 
    
    
        AskNilesh
        
- 67,701
- 16
- 123
- 163
- 
                    I have tried android:inputType="textCapSentences" in XML but it is still showing WORK only. – Vikash Kumar Jun 12 '17 at 09:40
1
            
            
        Configure your EditText with android:textAllCaps="false".
Then programatically modify your variable as you want using String function as toLowerCase (for the all string) and toUpperCase(the first letter).
 
    
    
        Mr_Perfect
        
- 8,254
- 11
- 35
- 62
 
    
    
        Tristan.L
        
- 11
- 1
1
            
            
        String str = yourEditText.getText().toString();
str = str.toUpperCase().charAt(0) + str.substring(1);
 
    
    
        Wasi Ahmad
        
- 35,739
- 32
- 114
- 161
 
    
    
        Fakhriddin Abdullaev
        
- 4,169
- 2
- 35
- 37
