Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:37:21+00:00 2026-06-15T20:37:21+00:00

This should be simple but I have tried about a dozen things here in

  • 0

This should be simple but I have tried about a dozen things here in stackoverflow on the topic and they either do nothing or crash.

I have a edittext field that starts with the last entry, like “12” and I want the initial cursor to be to the right of the 2 and it always starts to the left of the 1. That would be fine if there was a del key but with only a back key on the keyboard, the user must manually re-position the cursor before typing over the old text. There are several fields and he most likely wants to leave most of them alone. What I want if he wants to just edit the second field to have him hit “next” “bs”, “bs”, “45”, “next”, “done”. this way he doesn’t have to position the cursor at all.

————UPDATE———————-

Here is the main file

package com.example.test;
import android.os.Bundle;
import android.app.Activity;
import android.widget.EditText;


public class MainActivity extends Activity {
    static EditText edit;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        edit = (EditText) findViewById(R.id.edit);
        edit.setSelection(edit.getText().toString().length());
    }
}

and here is the xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<EditText
    android:id="@+id/edit"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/textView2"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="60dp"
    android:text="12"
    android:nextFocusDown="@+id/textView4"
    android:inputType="number"
    android:ellipsize="end"
    android:gravity="right"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/edit"
    android:layout_alignBottom="@+id/edit"
    android:layout_toRightOf="@+id/edit"
    android:text=":"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<EditText
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/textView3"
    android:layout_alignBottom="@+id/textView3"
    android:layout_toRightOf="@+id/textView3"
    android:text="00"
    android:inputType="number"
    android:textAppearance="?android:attr/textAppearanceLarge" />

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:37:22+00:00Added an answer on June 15, 2026 at 8:37 pm

    Use setSelection() on each EditText in onCreate():

    edit.setSelection(edit.getText().toString().length());
    edit2.setSelection(edit2.getText().toString().length());
    

    The cursor will still respect the user’s touch gestures, but trackball and other movements methods will start with the cursor on the right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be really simple, but I have tried many solutions posted on the
This should be a simple issue but I can't figure this out. I have
This should be simple, but I'm getting confused. I have a parent/child tables -
This should be quite simple, but I can't work out the syntax. I have
This should be so simple, but I'm drawing a blank. I have two tables.
This should be pretty simple, but I am new at LINQ. I have a
This seems like it should be so simple, but apparently it isn't. I have
This should be pretty simple, but I can't seem to get it. I have
This should have been a simple thing to sort but even after extensive research
I think this should be simple but I am having some difficulty implementing it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.