title: NullPointerException with ListView and G calss
body: <p>I maked a G class:</p>
  
  <pre><code>public class G extends Application {
  
      public static Context                  context;
      public static LayoutInflater           inflater;
      public static Activity                 currentActivity;
      public static ArrayList&lt;StructAnatomy&gt; notes = new ArrayList&lt;StructAnatomy&gt;();
  
  
      @Override
      public void onCreate() {
          super.onCreate();
          context = getApplicationContext();
          inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  }
  </code></pre>
  
  <p>and defined G class in AndroidManifest.xml :</p>
  
  <pre><code>&lt;application
      android:name=".G"  //******************************** here
      android:icon="@drawable/icon"
      android:label="@string/app_name" &gt;
      &lt;activity
          android:name=".Home"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name=".Activity1"
          android:label="@string/app_name" &gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>I make a list in Activity1 class and it's activity1.xml (contain list). No Error when program starting by Activity1, but when program starting by Home Activity and then go in Anatomy1 Activity, makeing an Error (NullPointerException).
  What solution to this problem exists???</p>
  
  <p>this is my Anatomy1 Activity:</p>
  
  <pre><code>public class Anatomy1 extends Activity {
  
      public ArrayList&lt;StructAnatomy&gt; anatomys1 = new ArrayList&lt;StructAnatomy&gt;();
  
      public ArrayAdapter             adapter;
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.anatomy1);
  
          ListView listAnatomy1 = (ListView) findViewById(R.id.listAnatomy1);
  
          adapter = new AdapterAnatomy(anatomys1);
          listAnatomy1.setAdapter(adapter);
  
          for (int i = 0; i &lt; 10; i++) {
              StructAnatomy anatomy1 = new StructAnatomy();
              anatomy1.title = "ANTERIOR VIEW" + i;
  
              anatomys1.add(anatomy1);
          }
  
          adapter.notifyDataSetChanged();
      }
  }
  </code></pre>
  
  <p>LogCat Error:
  03-14 12:54:16.288: E/AndroidRuntime(1753):     at m.k.Home$1.onTouch(Home.java:45)</p>
  
  <p>Home Activity (some codes):</p>
  
  <p>anatomy1_1.setOnTouchListener(new OnTouchListener() {</p>
  
  <pre><code>    final ImageView anatomy1_1 = (ImageView) findViewById(R.id.anatomy1_1);
  
          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
              anatomy1_1.setImageResource(R.drawable.anatomy1_2);
              Intent intent = new Intent(Home.this, Anatomy1.class);
              Home.this.startActivity(intent);
              return false;
          }
      });
  </code></pre>