title: Error: The Type MainActivity Is Already Defined
body: <p>I am working on getting the final kinks out of an example app I am doing. I have solved many of my problems by getting help from people on stackoverflow, but I still cannot get this last thing fixed! Could someone edit this code so I do not get the error "The type MainActivity is already defined" the second time I use it? I can see why this is bad formatting but I do not know how to fix it! Here is the code:</p>
  
  <pre><code>package com.example.progressdialog;
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  
  public class MainActivity extends Activity {
  
  
     public class mainactivity2 {
  
      }
  private ProgressDialog progress;
     @Override
     protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        progress = new ProgressDialog(this);
     }
  
  
     public void open(View view){
        progress.setMessage("Progressing!");
        progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        progress.setIndeterminate(false);
        progress.show();
  
     final int totalProgressTime = 100;
  
     final Thread t = new Thread(){
  
     @Override
     public void run(){
  
        int jumpTime = 0;
        while(jumpTime &lt; totalProgressTime){
           try {
              sleep(500);
              jumpTime += 1;
              progress.setProgress(jumpTime);
           } catch (InterruptedException e) {
  
  
             e.printStackTrace();
           }
  
        }
  
     }
     };
     t.start();
  
     }
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
  
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
     }
  }
  
  public class MainActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main2);
  
          Button next = (Button) findViewById(R.id.button2);
          next.setOnClickListener(new View.OnClickListener() {
              public void onClick(View view) {
                  Intent myIntent = new Intent(view.getContext(), Activity2.class);
                  startActivityForResult(myIntent, 0);
              }
  
          });
      }
  }
  </code></pre>