title: Adapter.getItem(position) crashes application
body: <p>I'm writing an Android Application with a custom Adapter for a list view.</p>
  
  <p>The adapter is a variable in the mainActivity class and contains a list of custom classes. I need to access a class in this list from an other activity, but the application seems to crash when it reaches getItem(position) in the adapter.</p>
  
  <p>Basically this is what the application looks like:</p>
  
  <p>in the MainActivity class there is a basic custom adapter:</p>
  
  <pre><code>public class MainActivity extends Activity {
      public static MyAdapter myAdapter;
      ...
  }
  </code></pre>
  
  <p>The adapter only has the basic functions like getItem and has a list of custom (basic) classes</p>
  
  <pre><code>public class MyAdapter extends BaseAdapter {
      private ArrayList&lt;MyClass&gt; tours = new ArrayList&lt;MyClass&gt;();
  
      @Override
      public Object getItem(int arg0) {
          return getItem(arg0);
      }
      ...
  }
  </code></pre>
  
  <p>When the other activity is opened, an index is passed to it to access a certain Object from the list.</p>
  
  <p>The only problem is that when I try to access a class from this list, the application crashes... 
  I used following code to access the class from the list in the adapter:</p>
  
  <pre><code>MyClass myClass = (MyClass)MainActivity.myAdapter.getItem(index);
  </code></pre>
  
  <p>Can someone tell me what I'm doing wrong or why the app crashes?</p>