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

  • SEARCH
  • Home
  • 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 6725411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:48:14+00:00 2026-05-26T09:48:14+00:00

I have a couple of queries regarding the EditText function in Android. First of

  • 0

I have a couple of queries regarding the EditText function in Android.

First of all, is it possible to set a minimum number of characters in the EditText field? I’m aware that there is an

android:maxLength="*"

however for some reason you can’t have

android:minLength="*"

Also, I was wondering if it is possible to launch a new activity after pressing the enter key on the keyboard that pops us when inputing data into the EditText field? And if so, could someone show me how?

Thanks for any help you could offer regarding either question 🙂

  • 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-05-26T09:48:15+00:00Added an answer on May 26, 2026 at 9:48 am

    To respond to an enter key in your edit field and notify the user if they haven’t entered enough text:

    EditText myEdit = (EditText) findViewById(R.id.myedittext);
        myEdit.setOnKeyListener(new OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                    if (myEdit.getText().length() < minLength) {
                        Toast.makeText(CurrentActivity.this, "Not enough characters", Toast.LENGTH_SHORT);
                    } else {
                        startActivity(new Intent(CurrentActivity.this, ActivityToLaunch.class);
                    }
                    return true;
                }
                return false;
            }
        });
    

    There’s no simple way to force a minimum length as the field is edited. You’d check the length on every character entered and then throw out keystrokes when the user attempt to delete past the minimum. It’s pretty messy which is why there’s no built-in way to do it.

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

Sidebar

Related Questions

All, I have couple of queries with respect to displaying html: I have a
I have a number of queries (in a C# project) that all use the
A couple of queries regarding the Tomcat manager and admin apps. I have tomcat
I have a couple of LINQ to SQL queries that I feel take a
I have couple questions regarding some C++ rules. Why am I able to call
I have a couple of questions regarding VBScript and ASP Classic: What is the
We have a couple of mirrored SQL Server databases. My first problem - the
I have a couple of queries for a web site that take a long
i have a couple of linq queries which I wanted to join var IDs
I'm using a LINQ to Entities, and I have a couple of queries for

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.