Dear Sirs and Madams,
I've had same problem (onCreate is called more than once), but in just one actvity. It occurs when phone is rotated. Is it normal? Can onCreate be called more than once in same activity?
Bellow, a simple test I've made to confirm it. There is just a button with id=button1 created via eclipse IDE. Every time I rotate phone, text of button returns to "123".
Source code:
package toc.p;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class ToncreatActivity extends Activity {
Button b1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button b1 = (Button) findViewById( R.id.button1 );
b1.setText( "123" );
b1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
b1.setText( "abc" );
}
});
}
}
The layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android

rientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>