Code example for EditText

Methods: getTextgetSelectionEndgetSelectionStart

0
 
        // Paste title button 
        layout.findViewById(R.id.paste).setOnClickListener(new OnClickListener() {
            @Override 
            public void onClick(View v) {
                int start = mMessageBox.getSelectionStart();
                int end = mMessageBox.getSelectionEnd();
                mMessageBox.getText().replace(Math.min(start, end), Math.max(start, end), title, 0,
                        title.length());
            } 
        }); 
 
        // Clear button 
        layout.findViewById(R.id.textViewClear).setOnClickListener(new OnClickListener() {
            @Override 
            public void onClick(View v) {
                mMessageBox.setText(null);
            } 
        }); 
 
        // GetGlue toggle