下面是我的代碼,不會執行任何東西下doInBackground
你們看到我錯了什麼嗎?,我只是添加物品稱爲「秩序」和顯示視圖。執行doInBackground(AsyncTask) - onCreate(Bundle savedInstanceState)
有幫助嗎?
private ArrayList<Order> m_orders = null;
private OrderAdapter m_adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
m_orders = new ArrayList<Order>();
new taskDoSomething().execute();
this.m_adapter = new OrderAdapter(this, R.layout.row, m_orders);
setListAdapter(this.m_adapter);
}
private class taskDoSomething extends AsyncTask<Void, Void, Void>
{
@Override
protected Void doInBackground(Void... params) {
Log.i("LOGGER", "Starting...doInBackground loadList");
m_orders = new ArrayList<Order>();
Order o1 = new Order();
o1.setOrderName("songs_array[0]");
o1.setOrderStatus("Pending");
o1.setQuantity(111);
m_orders.add(o1);
return (null);
}
@Override
protected void onPostExecute(Void result) {
Log.i("LOGGER", "...Done doInBackground loadList");
}
}
感謝小費1+ – 2012-02-27 20:06:48