TextView getSelectionStart - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView getSelectionStart method.

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);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSelection, getSelectionEnd, getSelectionStart, setTransformationMethod
                                                   .toString());
  } 
 
  @Override 
  public void onCheckedChanged(CompoundButton cb, boolean isChecked) {
    int start=passphrase.getSelectionStart();
    int end=passphrase.getSelectionEnd();
 
    if (isChecked) {
      passphrase.setTransformationMethod(null);
    } 
    else { 
      passphrase.setTransformationMethod(new PasswordTransformationMethod());
    } 
 
    passphrase.setSelection(start, end);
  } 
 
  void populate(int id, String _title, String _passphrase) {
    this.id=id;
    title.setText(_title);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText, getSelectionEnd, getSelectionStart
    editor.setOnKeyListener(this);
  } 
 
  @Override 
  public boolean onKey(View v, int keyCode, KeyEvent event) {
    Editable text=editor.getText();
 
    if (keyCode == KeyEvent.KEYCODE_TAB) {
      text.insert(editor.getSelectionStart(), "\t");
    } 
    else if (event.isCtrlPressed()) {
      int rawStart=editor.getSelectionStart();
      int rawEnd=editor.getSelectionEnd();
      int selStart=(rawStart>rawEnd ? rawEnd : rawStart);
      int selEnd=(rawStart>rawEnd ? rawStart : rawEnd);
       
      switch (keyCode) {
        case KeyEvent.KEYCODE_T:
          Toast.makeText(this,
                         TextUtils.substring(text, selStart, selEnd),
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText, setSelection, getSelectionStart, setText
        /* If we don't have displayed values then use the 
         * current number else find the correct value in the 
         * displayed values for the current number. 
         */ 
        if (mDisplayedValues == null) {
            int curSelectedPos = mText.getSelectionStart();
            int curTextLength = mText.getText().length();
             
            mText.setText(formatNumber(mCurrent));
             
            /* Preserve previous cursor position (right justified) */ 
            selectPos = mText.getText().length();
            selectPos -= (curTextLength - Math.max(curSelectedPos, 0));
            selectPos = Math.max(selectPos, 0);
        } else { 
            mText.setText(mDisplayedValues[mCurrent - mStart]);
            selectPos = mText.getText().length();
        } 
        mText.setSelection(selectPos);
    } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText, getSelectionEnd, getSelectionStart
    @Override 
    protected void onPause() { 
        super.onPause(); 
 
        SharedPreferences.Editor editor = getPreferences(0).edit();
        editor.putString("text", mSaved.getText().toString());
        editor.putInt("selection-start", mSaved.getSelectionStart());
        editor.putInt("selection-end", mSaved.getSelectionEnd());
        editor.commit();
    } 
 
    private EditText mSaved;
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSelectionEnd, getSelectionStart
      start=temp;
    } 
  } 
 
  Selection(EditText editor) {
    this(editor.getSelectionStart(), editor.getSelectionEnd());
  } 
 
  boolean isEmpty() { 
    return(start == end);
  } 
 
  void apply(EditText editor) {
    editor.setSelection(start, end);
  } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSelectionStart
		textView.setText(text);
	} 
 
	@Override 
	public int getSelection() { 
		return textView.getSelectionStart();
	} 
 
	@Override 
	public void setSelection(int selection) {
		if (textView instanceof EditText) {
			((EditText) textView).setSelection(selection);
		} 
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText, getSelectionStart
        outAnimDown.setDuration(ANIM_DURATION);
    } 
 
    void insert(String delta) {
        EditText editor = (EditText) getCurrentView();
        int cursor = editor.getSelectionStart();
        editor.getText().insert(cursor, delta);
    } 
 
    EditText getEditText() {
        return (EditText) getCurrentView();
    } 
 
    Editable getText() {
        EditText text = (EditText) getCurrentView();
        return text.getText();
    } 
 
    private void setText(String input) {
        EditText text = (EditText) getCurrentView();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSelectionStart, length
        mLineLength = nDigits;
    } 
 
    boolean eatHorizontalMove(boolean toLeft) {
        EditText editText = mDisplay.getEditText();
        int cursorPos = editText.getSelectionStart();
        return toLeft ? cursorPos == 0 : cursorPos >= editText.length();
    } 
 
    private String getText() {
        return mDisplay.getText().toString();
    } 
 
    void insert(String delta) {
        mDisplay.insert(delta);
        setDeleteMode(DELETE_MODE_BACKSPACE);
    } 
 
    public void onTextChanged() { 
        setDeleteMode(DELETE_MODE_BACKSPACE);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText, getSelectionStart
        outAnimDown.setDuration(ANIM_DURATION);
    } 
 
    void insert(String delta) {
        EditText editor = (EditText) getCurrentView();
        int cursor = editor.getSelectionStart();
        editor.getText().insert(cursor, delta);
    } 
 
    EditText getEditText() {
        return (EditText) getCurrentView();
    } 
         
    Editable getText() {
        EditText text = (EditText) getCurrentView();
        return text.getText();
    } 
     
    void setText(CharSequence text, Scroll dir) {
        if (getText().length() == 0) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related TextView getSelectionStart Questions & Answers:

getSelectionStart Method Overview
Convenience for getSelectionStart(CharSequence).
See Code Examples for other Android TextView Methods: