TextView getSelectionEnd - 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 getSelectionEnd method.

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
Connect your IDE to all the code out there  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
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);
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, 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
Connect your IDE to all the code out there  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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getText, getSelectionEnd, getSelectionStart
		wm.updateViewLayout(this, winparams);
 
	} 
	 
	public void copy(){ 
		int start = ed.getSelectionStart();
		int end = ed.getSelectionEnd();
		if(start == end){
			clipboard.setText(ed.getText()); // just copy everything, nothing is selected.
		}else{ 
			clipboard.setText(ed.getText().subSequence(Math.min(start,end), Math.max(start,end))); // copy what is selected
		} 
		 
		Toast.makeText(context, "Copied", Toast.LENGTH_SHORT).show();
	} 
	public void paste(){ 
		CharSequence in = clipboard.getText();
		try{ 
			if(ed.getText() != null){
				int start = ed.getSelectionStart();
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related TextView getSelectionEnd Questions & Answers:

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