title: Why cursor always goes to beginning of EditText when click Toggle button in Android?
body: <p>First of all, I apologize for my bad English Grammar.</p>
  <p>There is a <code>toggleButton</code> and <code>EditText</code> in my Simple Android Application. When I click the toggle button <code>editText</code> Box change into the password field and a normal text field.
  That is working perfectly, but the problem is when I click the toggle button cursor always goes to the beginning of the Text.</p>
  <p>Example: When Type <strong>stack</strong> it shows as ..... after clicking toggle button that words appear but cursor goes into the front of 's' it does not stay after 'k'</p>
  <p>How can I correct this issue?</p>
  <p><strong>This is <code>EditText</code> and toggle Button <code>xml</code> code</strong></p>
  <pre><code>    &lt;EditText
              android:id=&quot;@+id/etCommand&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_gravity=&quot;center&quot;
              android:hint=&quot;@string/command&quot;
              android:password=&quot;true&quot; /&gt;
  &lt;ToggleButton
              android:id=&quot;@+id/tglBtn&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;75&quot;
              android:checked=&quot;true&quot;
              android:onClick=&quot;changeField&quot;
              android:paddingBottom=&quot;5dp&quot;
              android:text=&quot;ToggleButton&quot; /&gt;
  </code></pre>
  <p><strong>and I change its behavior using the following code</strong></p>
  <pre><code>if (passTog.isChecked()) 
      {
          input.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_PASSWORD);
      } 
      else 
      {
          input.setInputType(InputType.TYPE_CLASS_TEXT);
      }
  </code></pre>
  <p>Thanks in advance.</p>