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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:38:58+00:00 2026-06-11T11:38:58+00:00

So EditTexts should save their Text when changing orientation. In this particular Fragment, they

  • 0

So EditTexts should save their Text when changing orientation.
In this particular Fragment, they dont. Why is that?

my Fragment:

 public class LoginFragment extends Fragment {

    /**
     * @param inflater
     * @param container
     * @param savedInstanceState
     * @return
     * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
     *      android.view.ViewGroup, android.os.Bundle)
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    return inflater.inflate(R.layout.login, container, false);

    }

    /**
     * 
     * @see android.support.v4.app.Fragment#onStart()
     */
    @Override
    public void onStart() {
    super.onStart();

    getView().findViewById(R.id.login_ok).setOnClickListener(
        new OnClickListener() {

            public void onClick(View v) {
            startActivity(new Intent(getActivity(),
                StartActivity.class));
            }
        });
    }
}

My edittexts in xml:

 <EditText
        android:id="@+id/login_user"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:background="@drawable/roundedcorner"
        android:ems="10"

        android:hint="@string/email"
        android:inputType="textEmailAddress"
        android:padding="8dp" >

        <requestFocus />
    </EditText>





    <EditText
        android:id="@+id/login_pw"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:background="@drawable/roundedcorner"
        android:ems="10"

        android:hint="@string/password"
        android:inputType="textPassword"
        android:padding="8dp" />

This is the onCreate Method of my Activity:

super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_login);
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.add(R.id.login_frame, new LoginFragment());
ft.commit();`
  • 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-11T11:38:59+00:00Added an answer on June 11, 2026 at 11:38 am

    Okay so I had this problem, because i added my Fragment with a FragmentTransaction into a FrameLayout(which had a unique ID).

    Now I’ve declared my Fragment once again in the XML with a unique ID and it works.

    I cant really explain why it wont work when adding it with a FragmentTransaction, if the container has an unique ID, but atleast it works now.

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

Sidebar

Related Questions

I have 3 edittexts with input type as number and 1 button that say
I have a listview that contain several EditTexts created dynamically according to the number
I know how to save string from EditTexts on android but my problem is:
I have a database that is being filled by user defined EditTexts. None of
In my class I create two EditTexts. editText1 = (EditText)findViewById(R.id.EditText1); editText2 = (EditText)findViewById(R.id.EditText2); When
This should be simple, but I have tried if statements checking for null values
I know that Android provides a mechanism to allow developers to save and restore
I want my EditText should work as AutoComplete , for that I write in
I assumed that each layout's element id's such as buttons, textviews, edittexts, etc. were
I am trying to make this app that calculates your grade average (based on

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.