Passing parameters to Asynctask

后端 未结 4 1415
日久生厌
日久生厌 2021-01-31 10:48

I am using Async tasks to get string from the menu activity and load up some stuff..but i am not able to do so..Am i using it in the right way and am i passing the parameters co

4条回答
  •  深忆病人
    2021-01-31 11:08

    AsyncTask means doInBackground() returns Void, onProgressUpdate() takes Integer params and doInbackground takes... String params !

    So you don't need (and REALLY shouldn't) use Intent, since it is meant to be used for passing arguments through Activities, not Threads.

    And as told before, you can make a constructor and a global parameter to your class called "identifier"

    public class Setup...
    {
        private String identifier;
    
        public Setup(String a) {
        identifier = a;
        }
    }
    

    Hoped it could help. Regards

提交回复
热议问题