title: Manage buttons in different XML files
body: <p>There are two xml files in my project,"main.xml" and "newn.xml". Button with id button1 in main.xml and button2 in newn.xml.</p>
  
  <p>I would like to click the button1 and go to newn layout file and come back to main layout when I click button2.</p>
  
  <pre><code>Button b = (Button) findViewById(R.id.button1);
      b.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              setContentView(R.layout.newn);
          }
      });
      Button b1 = (Button) findViewById(R.id.button2);
  b1.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              setContentView(R.layout.main);
          }
      });
  </code></pre>
  
  <p>but there was a run time error.</p>