title: Android, java - Unable to update variable from asynctask
body: <p>Here is the code</p>
  
  <p>Variable declared</p>
  
  <pre><code> public String gpu2dcurent = "1234567";
  </code></pre>
  
  <p>Asynctask, after finished it should update variable gpu2dcurent, but it doesnt</p>
  
  <pre><code> private class readgpu2d extends AsyncTask&lt;String, Void, String&gt; {
  
  
      protected String doInBackground(String... args) {
           Log.i("MyApp", "Background thread starting");
  
           String aBuffer = "";
  
           try {
  
              File myFile = new File("/sys/devices/platform/kgsl-2d0.0/kgsl/kgsl-2d0/gpuclk");
              FileInputStream fIn = new FileInputStream(myFile);
              BufferedReader myReader = new BufferedReader(
                      new InputStreamReader(fIn));
              String aDataRow = "";
              //String aBuffer = "";
              while ((aDataRow = myReader.readLine()) != null) {
                  aBuffer += aDataRow + "\n";
              }
  
              ;
              myReader.close();
  
          } catch (Exception e) {
              Toast.makeText(getBaseContext(), e.getMessage(),
                      Toast.LENGTH_SHORT).show();
  
          }
  
           return aBuffer.trim();
       }
  
       protected void onPostExecute(String result) {
           // Pass the result data back to the main activity
          gpu2dcurent = result;
           //Toast.makeText(getBaseContext(), result,
                  //Toast.LENGTH_SHORT).show();
           gpu.this.data = result;
  
           if (gpu.this.pd != null) {
               //gpu.this.pd.dismiss();
           }
       }
  
      }
  </code></pre>
  
  <p>Test to see if a variable has a new value. It doesn't, it displays 1234567</p>
  
  <pre><code> TextView tx = (TextView)findViewById(R.id.textView3);
  tx.setText(gpu2dcurent);
  </code></pre>
  
  <p>Am i missing something? When i update textView from inside onPostExecute method it works fine but when Asynctask finishes variable value resets to default</p>
  
  <pre><code> public class gpu extends Activity{
  
  public String gpu2dcurent = "1234567";
  </code></pre>