Android Asynctask passing a single string

前端 未结 2 1239
孤街浪徒
孤街浪徒 2021-02-07 04:56

I would like to pass a single string into an asynctask. Could anyone show me how it is done? my getEntity needs The method getEntity(Activity, String, EntityGetListener) but I k

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 05:28

    You already have this

         new RemoteDataTask().execute(pass); // assuming pass is a string
    

    In doInbackground

         @Override
         protected Long doInBackground(String... params) {   
    
                 String s = params[0]; // here's youre string
                 ...      //rest of the code. 
         }
    

    You can find more info @

    http://developer.android.com/reference/android/os/AsyncTask.html

提交回复
热议问题