Hi,

i've just registered due to a problem with android/eclipse

I tried to make a simple App, which just switches between 2 layout xml-files (main.xml and main2.xml)..

button1 is in the main.xml file, button2 is in the main2.xml file.

Here's the code:

public class LayoutWechselnTestActivity extends Activity {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.main2);
final Button buttonMain2 = (Button) findViewById(R.id.button2);
buttonMain2.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
setContentView(R.layout.main);
}
});

setContentView(R.layout.main);
final Button buttonMain1 = (Button) findViewById(R.id.button1);
buttonMain1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
setContentView(R.layout.main2);
}
});
}
}

..my Problem is: The App starts in the main.xml file; and when clicking at Button1 the app switches successful to the layout of main2.xml. However when I try switching back to main.xml again, it simply does nothing -.-