title: Integer looks null in outside class
body: <p>I have a static Integer currentheartbeat in my inner asynctask class it shows the value but outside the asynctask class it looks null,i cant seem to reach it.What is the reason for it?</p>
  
  <p><a href="https://github.com/berkkarabacak/Mspproje" rel="nofollow">Github of my Android Project</a></p>
  
  <p>My Class:</p>
  
  <pre><code>package com.berkkarabacak.mspproje;
  
  import android.app.Activity;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.widget.TextView;
  
  import com.microsoft.azure.storage.CloudStorageAccount;
  import com.microsoft.azure.storage.blob.CloudBlob;
  import com.microsoft.azure.storage.blob.CloudBlobClient;
  import com.microsoft.azure.storage.blob.CloudBlobContainer;
  import com.microsoft.azure.storage.blob.CloudBlockBlob;
  import com.microsoft.azure.storage.blob.ListBlobItem;
  
  import java.io.File;
  import java.io.FileInputStream;
  
  
  public class Checkactivity extends ActionBarActivity {
      String tcnumara;
      static Integer currentheartbeat;
      static String currentheartbeatstring;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.checkheartbeat);
          Bundle extras = getIntent().getExtras();
          if (extras != null) {
              tcnumara = extras.getString("tcnumber");
          }
          TextView t = (TextView) findViewById(R.id.tcnumaraset);
          t.setText(tcnumara);
          new Azure().execute();
          System.out.print(currentheartbeat);
          System.out.print(currentheartbeat);
          System.out.print(currentheartbeat);
          System.out.print(currentheartbeat);
          currentheartbeatstring=Integer.toString(currentheartbeat);
          TextView t2=(TextView)findViewById(R.id.currentheartbeat);
          t2.setText(currentheartbeatstring);
  
  
      }
      public class Azure extends AsyncTask&lt;Void, Void, Void&gt; {
  
          public static final String ConnectionString =
                  "DefaultEndpointsProtocol=http;"
                          + "AccountName=mspproje;"
                          + "AccountKey=bpBHfSA4uVJVJjxaQcOCKTH7Hib/NAJslvOvnl6q65x652mUahzu6JXKPxAhyP8/w/WKp0htVS5/EVhjaGTkaA==";
  
  
          @Override
          protected Void doInBackground(Void... voids) {
  
              try
              {
  
                  // Retrieve storage account from connection-string.
                  CloudStorageAccount storageAccount = CloudStorageAccount.parse(ConnectionString);
  
                  // Create the blob client.
                  CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
  
                  // Retrieve reference to a previously created container.
                  CloudBlobContainer container = blobClient.getContainerReference("mspproje");
                  // Define the path to a local file.
                  final String filePath = "C:\\Users\\Berk\\Desktop\\audi.jpg";
  
                  // Create or overwrite the "myimage.jpg" blob with contents from a local file.
                  CloudBlockBlob blob = container.getBlockBlobReference(MainActivity.tcnumara+".csv");
                  String lastelementdeleted=blob.downloadText().substring(0, blob.downloadText().length() - 1);
  
                  currentheartbeat=Integer.parseInt(lastelementdeleted.substring(lastelementdeleted.lastIndexOf(";")+2));
                  System.out.println(currentheartbeat+"in inner async try");
              }
  
  
          catch (Exception e)
          {
              // Output the stack trace.
               e.printStackTrace();
          }
  
  
  
          return null;
          }
      }
  
  
  
  }
  </code></pre>
  
  <p>Here in logcat you can see it it shows 52 in inner async class but at main outside class it looks null</p>
  
  <pre><code>04-16 00:35:03.244  30866-30866/com.berkkarabacak.mspproje E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.berkkarabacak.mspproje, PID: 30866
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.berkkarabacak.mspproje/com.berkkarabacak.mspproje.Checkactivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2693)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
              at android.app.ActivityThread.access$900(ActivityThread.java:177)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:145)
              at android.app.ActivityThread.main(ActivityThread.java:5942)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
              at com.berkkarabacak.mspproje.Checkactivity.onCreate(Checkactivity.java:41)
              at android.app.Activity.performCreate(Activity.java:6283)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
              at android.app.ActivityThread.access$900(ActivityThread.java:177)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:145)
              at android.app.ActivityThread.main(ActivityThread.java:5942)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
  04-16 00:35:03.324  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ nullnullnullnull(HTTPLog)-Static: isSBSettingEnabled false
  04-16 00:35:03.324  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ (HTTPLog)-Static: isShipBuild true
  04-16 00:35:03.324  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ (HTTPLog)-Thread-17315-974616881: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
  04-16 00:35:03.324  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
  04-16 00:35:03.504  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
  04-16 00:35:03.699  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
  04-16 00:35:03.774  30866-31340/com.berkkarabacak.mspproje I/System.out﹕ 52in inner async try
  </code></pre>