Как я могу вернуть ArrayList объектов и строку из одного класса aSyncTask.Возврат ArrayList и String asyncTask
aSyncTask использует jsoup для извлечения 3 элементов таблицы, которые помещаются в новый класс Employee, а затем возвращаются в MainActivity в качестве arraylist, но я хочу, чтобы он также возвращал строку для этой конкретной таблицы.
MainActivity
public void onButtonClick()
new GetEmployee() {
@Override
protected void onPostExecute(ArrayList<Employee> list) {
Intent intent = new Intent(getApplicationContext(), EmployeeActivity.class);
intent.putParcelableArrayListExtra("empClass", list);
//i want to also pass the title of the Employee table aswell as the list,
//after running the aSyncTask
startActivity(intent);
}
}.execute();
GetEmployee
public Employee empObj;
@Override
protected ArrayList<Employee> doInBackground(String... params)
{
ArrayList<Employee> emp = new ArrayList<Employee>();
String title;
try {
//get employee details from table using JSoup
//get employee table title using JSoup
empObj = new Emp(...);
emp.add(empObj);
return emp;
} catch (IOException e) {
e.printStackTrace();
}
return emp;
Как бы я возвращать строку из здесь, а также в ArrayList сотрудника
на посту выполнить возвратить arraylist к вашему методу или что-то еще. –
Я обновил свой ответ после проверки. –