Here is the code
Variable declared
public String gpu2dcurent = \"1234567\";
Asynctask, after finished it should update variable gpu2dc
I have a doubt you are trying to set text of TextView
before completion of your Asynctask.
Yes, either make it, static public String gpu2dcurent = "1234567";
Or, set Text of TextView
in onPostExecute()
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();
}
tx.setText(gpu2dcurent);
}
}
Update:
After update your code in question,
change this line,
new readgpu2d().execute("blablabla");
to
new readgpu2d().execute("blablabla").get();