I have three activity in my application. In my second activity I have some elements that are made dynamically by user. When I click on device back button or go to third activity, second activity restarts. Why? first activity:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second );
}
and in second activity i creat element:
final TableLayout tbl=(TableLayout)findViewById(R.id.tblProduct);
TableRow row=new TableRow(this);
EditText ed=new EditText(this);
ed.setLayoutParams( new TableRow.LayoutParams( 0, android.view.ViewGroup.LayoutParams.WRAP_CONTENT,.10f ) );
row.addView(ed);
tbl.addView(row);
when i back to first activity the created element be cleared.