How to get a string back from AsyncTask?

前端 未结 8 2045
Happy的楠姐
Happy的楠姐 2020-12-03 04:01

I have the following class:

public class getURLData extends AsyncTask{

@Override
protected String doInBackground(String... pa         


        
8条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 04:38

    The only way to send data from AsyncTask to UI without pain is Otto or Event bus. Register a method which will handle a result under @Subscribe annotation in UI and post a message with a result to it in onPostExecute method of your AsyncTask.

提交回复
热议问题