Android, java - Unable to update variable from asynctask

后端 未结 4 742
无人及你
无人及你 2021-02-11 04:51

Here is the code

Variable declared

 public String gpu2dcurent = \"1234567\";

Asynctask, after finished it should update variable gpu2dc

4条回答
  •  别那么骄傲
    2021-02-11 05:22

    try to put setText into onPostExecute

    protected void onPostExecute(String result) {
         TextView tx = (TextView)findViewById(R.id.textView3);
         tx.setText(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();
         }
     }
    

提交回复
热议问题