Note that there are some explanatory texts on larger screens.

plurals
  1. POWrong value in EditText when changing screen orientation
    primarykey
    data
    text
    <p>Im confused.</p> <p>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.</p> <p>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.</p> <p>Any idea?</p> <p>Here is the relevant part of code:</p> <pre><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); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload