title: how to count number of objects created of inner class
body: <p>I have an activity and inside it I have a class called AsyncTask. Inside the AsyncTask class I want to declare a counter as a static variable but I can't because the AsyncTask class is assumed as an inner class to the mainActivity.</p>
  
  <p>Is there any way to create a static variable inside the AsycTask "inner class" to count the number of objects created of the AsyncTask for an example?</p>
  
  <p><strong>code</strong></p>
  
  <pre><code>class MainActivity extends Activity {
      ....
      ....
      ....
      ....
  
      class MyAsync extends AsyncTask &lt;void, Void, Void&gt; {
  
          private static int counter = 0; // is not possible here
      }
  
  }
  </code></pre>