How to set the cursor at end in edittext
<p>Whenever i touch the edittext, cursor should be at end.Even if the editText is already having some text and it should not allow to move left awards </p>

<pre><code> editTextView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {

                    editTextView.onTouchEvent(event);

                    if(!textFocus) {
                        editTextView.setSelection(editTextView.getText().length());
                        textFocus = true;
                    }

                    return true;
                }
            });

            editTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public void onFocusChange(View v, boolean hasFocus) {
                    textFocus = false;
                }
            });
</code></pre>