如何从一个aSyncTask类中返回一个对象的ArrayList和一个String。
aSyncTask使用jsoup来检索表格的3个元素,这些元素被放入一个新的Employee类中,然后作为ArrayList返回到MainActivity,但我也希望它能够返回该特定表格的一个String。
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();
获取员工信息
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;
我该如何在这里返回一个String和一个Employee的ArrayList?