public void handleMessage(Message msg) { if (builder != null && builder.isShowing()) { builder.dismiss(); } switch (msg.what) { case 0: onLoad(); onRefresh_number = true; mAdapter.updateListView(orderList); if (orderList.size() == 0) { Toast.makeText(getApplicationContext(), R.string.no_list, Toast.LENGTH_SHORT) .show(); } break; case 1: onLoad(); Toast.makeText(getApplicationContext(), (String) msg.obj, Toast.LENGTH_SHORT).show(); break; case 2: // 网络有问题 Toast.makeText(getApplicationContext(), R.string.no_internet, Toast.LENGTH_SHORT) .show(); break; case 3: Toast.makeText(getApplicationContext(), R.string.refresh_toomuch, Toast.LENGTH_SHORT) .show(); break; } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (resultCode) { case -11: orderList.remove(index); // mAdapter.updateListView(orderList); break; case -12: finish(); break; default: break; } super.onActivityResult(requestCode, resultCode, data); }