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 6876243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:27:11+00:00 2026-05-27T04:27:11+00:00

I make a login form with dynamic field validation. I have 3 fields username,

  • 0

I make a login form with dynamic field validation. I have 3 fields username, email & password & all of these field are required. When field length = 0, I set error

editText.setError( getText(R.string.cannot_be_blank) );

and this code works fine, but when I change the orientation, all the errors disappear
How to save error state?

Thanks.

  • 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-27T04:27:11+00:00Added an answer on May 27, 2026 at 4:27 am

    When the orientation is changed the framework will recreate the Activity by calling onCreate(Bundle savedInstanceState). Before the switch in orientation the onSaveInstanceState(Bundle outState) method will be called if it is overridden in your Activity.

    You can save the state of your errors in the Bundle passed into the onSaveInstanceState method. This bundle is passed to your onCreate() method as the savedInstanceState Bundle.

    Therefore you need to override the onSaveInstanceState method in your Activity as follows (saving the state of your errors):

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putBoolean("errorOccurred", errorState);
        super.onSaveInstanceState(outState);
    }
    

    Then in your onCreate method check if the savedInstateState Bundle is null or not. If not, you can retrieve the values out of it with the following code:

    boolean errorOccurred = false;  
    if (savedInstanceState != null) {
        errorOccurred = savedInstanceState.getBoolean("errorOccurred"); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a normal username/password login form secure, without needing HTTPS. My
I have simple login form in my website. In given requirements stands, that password
Can the form-login tag make use of URLs to external resources? I have two
I have WPF application that has a login form. I would like to make
i am trying to make a custom login form in drupal-6.22 using Email Registration
I have already tried to make a login form and I also want to
I am trying to make a login form through Oracle's Form Builder, I have
Why do i have to use some persistent-login module to make my users login
I am trying to make a login application so you can view grades/email teachers/etc.
I have a login form that is hidden on every page and shows itself

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.