Android EditText - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android EditText class.

This code example shows how to use the following methods: getText
	@Inject 
	GreetingService greetingService;
	 
	@Click 
	void button() { 
		String name = edit.getText().toString();
		greetingService.greet(name);
	} 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getText
        final EditText password = editText(id.et_password);
        focus(login);
        send("loginname"); 
        assertEquals("loginname", login.getText().toString());
        assertFalse(loginMenu.isEnabled());
        focus(password);
        send("password"); 
        assertEquals("password", password.getText().toString());
        assertTrue(loginMenu.isEnabled());
    } 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getText
    } 
 
 
    @Click 
    void myButtonClicked() { 
        String name = myEditText.getText().toString();
        setProgressBarIndeterminateVisibility(true);
        someBackgroundWork(name, 5);
    } 
 
    @Background 
    void someBackgroundWork(String name, long timeToDoSomeLongComputation) {
        try { 
            TimeUnit.SECONDS.sleep(timeToDoSomeLongComputation);
        } catch (InterruptedException e) {
        } 
 
        String message = String.format(helloFormat, name);
 
        updateUi(message, androidColor);
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setEnabled, setInputType, setMaxHeight, setText
	} 
	 
	public InputDialog( String title, String message, String text, boolean editable, boolean password, Activity activity, InputDialogListener inputDialogListener ){
		super( activity );
		 
		mEditText = new EditText( activity );
		 
		if( text != null )
			mEditText.setText(text);
		 
		mEditText.setEnabled( editable );
		mEditText.setMaxHeight( 250 );
		 
		if( password )
			mEditText.setInputType( InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD );
				 
		this.setTitle( title );
		this.setMessage( message );
		this.setView( mEditText );
		 
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setSelection, getSelectionEnd, getSelectionStart, setTransformationMethod
    toggleShowPassphrase(passphrase, isChecked);
    toggleShowPassphrase(confirm, isChecked);
  } 
 
  private void toggleShowPassphrase(EditText field, boolean isChecked) {
    int start=field.getSelectionStart();
    int end=field.getSelectionEnd();
 
    if (isChecked) {
      field.setTransformationMethod(null);
    } 
    else { 
      field.setTransformationMethod(new PasswordTransformationMethod());
    } 
 
    field.setSelection(start, end);
  } 
 
  @Override 
  public void onClick(View v) {
    v.setEnabled(false);
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getText
    lon=(EditText)findViewById(R.id.lon);
  } 
   
  public void showMe(View v) {
    String _lat=lat.getText().toString();
    String _lon=lon.getText().toString();
    Uri uri=Uri.parse("geo:"+_lat+","+_lon);
     
    startActivity(new Intent(Intent.ACTION_VIEW, uri));
  } 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setSelection, getSelectionEnd, getSelectionStart, setTransformationMethod
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setText
    return mEditText;
  } 
 
  @Implementation 
  public void setText(java.lang.String text) {
    mEditText.setText(text);
  } 
 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getText, setText
        assertThat(textView.getText().toString()).isEqualTo("<b>some</b> html text");
    } 
 
    @Test 
    public void shouldBeAbleToGetTextFromEditTextAfterUsingSetTextWithHtmlDotFromHtml() throws Exception { 
        EditText editText = new EditText(context);
        editText.setText(Html.fromHtml("<b>some</b> html text"));
        assertThat(editText.getText().toString()).isEqualTo("<b>some</b> html text");
    } 
 
    @Test(expected = NullPointerException.class) 
    public void shouldThrowNullPointerExceptionWhenNullStringEncountered() throws Exception { 
        Html.fromHtml(null);
    } 
 
    public void fromHtml_shouldJustReturnArgByDefault() { 
        String text = "<b>foo</b>";
        Spanned spanned = Html.fromHtml(text);
        assertEquals(text, spanned.toString());
    } 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getText, setSelection
		return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
				val, ctx.getResources().getDisplayMetrics());
	} 
 
	public static void putCursorAfterLastSymbol(EditText editText) {
		editText.setSelection(editText.getText().length());
	} 
 
	public static void showKeyboard(final View view) {
		new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
 
			@Override 
			public void run() { 
				setKeyboardVisible(view, true);
			} 
		}, 200); 
	} 
 
	public static void setKeyboardVisible(View view, boolean visible) {
		InputMethodManager imm = (InputMethodManager) view.getContext()
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android EditText Questions & Answers:

Other Android EditText Examples

10:	public class FirstScreenActivity extends Activity {
11:		// Initializing variables
12:		EditText inputName;
13:		EditText inputEmail;
14:		@Override
-
11:		// Initializing variables
12:		EditText inputName;
13:		EditText inputEmail;
14:		@Override
15:		public void onCreate(Bundle savedInstanceState) {
-
17:			setContentView(R.layout.screen1);
18:	
19:			inputName = (EditText) findViewById(R.id.name);
20:			inputEmail = (EditText) findViewById(R.id.email);
21:			Button btnNextScreen = (Button) findViewById(R.id.btnNextScreen);
-
18:	
19:			inputName = (EditText) findViewById(R.id.name);
20:			inputEmail = (EditText) findViewById(R.id.email);
21:			Button btnNextScreen = (Button) findViewById(R.id.btnNextScreen);
22:

Read More

20:		
21:		// Search EditText
22:		EditText inputSearch;
23:		
24:		
-
37:	        
38:	        lv = (ListView) findViewById(R.id.list_view);
39:	        inputSearch = (EditText) findViewById(R.id.inputSearch);
40:	        
41:	        // Adding items to listview

Read More

17:		
18:		// UI elements
19:		EditText txtName;
20:		EditText txtEmail;
21:		
-
18:		// UI elements
19:		EditText txtName;
20:		EditText txtEmail;
21:		
22:		// Register button
-
50:			}
51:			
52:			txtName = (EditText) findViewById(R.id.txtName);
53:			txtEmail = (EditText) findViewById(R.id.txtEmail);
54:			btnRegister = (Button) findViewById(R.id.btnRegister);
-
51:			
52:			txtName = (EditText) findViewById(R.id.txtName);
53:			txtEmail = (EditText) findViewById(R.id.txtEmail);
54:			btnRegister = (Button) findViewById(R.id.btnRegister);
55:

Read More

1:	EditText editText = (EditText) findViewById(R.id.search);
2:	editText.setOnEditorActionListener(new OnEditorActionListener() {
3:	    @Override
-
1:	EditText editText = (EditText) findViewById(R.id.search);
2:	editText.setOnEditorActionListener(new OnEditorActionListener() {
3:	    @Override

Read More

See Code Examples for Android EditText Methods: