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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:06:15+00:00 2026-05-23T20:06:15+00:00

Im confused. I have a layout (LinearLayout) holding a TextView and EditText. Somewhere in

  • 0

Im confused.

I have a layout (LinearLayout) holding a TextView and EditText.
Somewhere in my code i create (programatically) a RelativeLayout and push in it several of this LinearLayouts. To each one of them i set an ID and values for TextView and EditText.

The problem is when i change screen orientation. All EditText controls gets the same value (from the last EditText). If i set a breakpoint all seems fine. I even inspected all elemets before setContentView is called and all values seem fine.

Any idea?

Here is the relevant part of code:

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  csWgs84 = getCoordinateSystem();
  wgs84C = getCoordinates();
  sView = new ScrollView(this);
  layout = getLayoutInflater().inflate(R.layout.location_calculator, null);

  View control1 = getLayoutInflater().inflate(R.layout.text_edit, null);
  control1.setId(1);
  TextView title1 = (TextView) control1.findViewById(R.id.title);
  title1.setText(csWgs84.axisInfo.yAxisAbbreaviation + " [°] :");
  EditText value1 = (EditText) control1.findViewById(R.id.input);
  value1.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
  value1.setText(cutValue(RSimpleFormatter.formatNumber(wgs84C.y, 1, 7, '.'), 12));
  RelativeLayout.LayoutParams viewLayoutParams1 = new RelativeLayout.LayoutParams
    (RelativeLayout.LayoutParams.FILL_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT );
      viewLayoutParams1.addRule(RelativeLayout.BELOW, group.getId());
  ((RelativeLayout) layout).addView(control1, viewLayoutParams1);

  View control2 = getLayoutInflater().inflate(R.layout.text_edit, null);
  control2.setId(2);
  TextView title2 = (TextView) control2.findViewById(R.id.title);
  title2.setText(csWgs84.axisInfo.xAxisAbbreaviation + " [°] :");
  EditText value2 = (EditText) control2.findViewById(R.id.input);
  value2.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
  value2.setText(cutValue(RSimpleFormatter.formatNumber(wgs84C.x, 1, 7, '.'), 12));
  RelativeLayout.LayoutParams viewLayoutParams2 = new RelativeLayout.LayoutParams
  (RelativeLayout.LayoutParams.FILL_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT );
     viewLayoutParams2.addRule(RelativeLayout.BELOW, control1.getId());
    ((RelativeLayout) layout).addView(control2, viewLayoutParams2);

  sView.addView(layout, scrollViewLayoutParams);
  setContentView(sView);
}
  • 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-23T20:06:16+00:00Added an answer on May 23, 2026 at 8:06 pm

    If the (admittedly usually very clever) default onPause() method isn’t dealing well your activity being pushed to memory and being reloaded from it then you need to override it.

    Use onPause to save the value’s of your programatically created fields in a bundle. In your onCreate method check for the presence of a Bundle and create you’re view’s from this.

    Activity Lifecycle

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

Sidebar

Related Questions

I have the following code and got myself confused: I have a query that
A common issue I have is getting confused what $(this) is referring to. I
We have been discussing this at work and now I am even more confused
I have the following python modules. Sorry if the code is ugly. This is
I have read many articles regarding layout, but I am still quitely confused. My
I am quite confused on how to have my own layout for each page
I am completely confused - I have a website that renders perfectly in IE8
In C++, the following lines have me confused: int temp = (int)(0×00); int temp
I have always been kind of confused by threads, and my class right now
I have read the docs and everything but I'm very confused. I never needed

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.