How to return ArrayList from AsyncTask to another class?

后端 未结 7 601
被撕碎了的回忆
被撕碎了的回忆 2021-01-21 20:01

i want to get Ftp folders list from server using AsyncTask and return folders names ArrayList to main class and update spinner adapter.

In main class i got spinner with

7条回答
  •  [愿得一人]
    2021-01-21 20:29

    In your AsyncTask you could have a member (MyActivity m_activity) with the same class of your activity.

    In your AsyncTask constructor, set a MyActivity parameter and record it in m_activity.

    In your onPostExecute run a method of your activity that refresh your spinner adapter: m_activity.updateSpinner(ftpTeacher );

提交回复
热议问题