private void writeToCard() { if (data.charAt(0) == 'S') { CardHelper helper = new CardHelper(WriteCardOnlineActivity.this, reader); ToastHelper.showShort(WriteCardOnlineActivity.this, data.substring(1)); ToastHelper.showShort(WriteCardOnlineActivity.this, data.substring(1).length() + ""); helper.writeCard(32, data.substring(1), cardPwd); } else if (data.charAt(0) == 'F') { ToastHelper.showShort(WriteCardOnlineActivity.this, data.substring(1)); } }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub switch (msg.what) { case GET_DATA_FAIL: ToastHelper.showShort(WriteCardOnlineActivity.this, "获取数据失败"); break; case GET_DATA_SUCCESS: ToastHelper.showShort(WriteCardOnlineActivity.this, "获取数据成功"); writeToCard(); break; case WRITE_CARD_FAIL: ToastHelper.showShort(WriteCardOnlineActivity.this, "写卡失败"); break; case WRITE_CARD_SUCCESS: ToastHelper.showShort(WriteCardOnlineActivity.this, "写卡成功"); break; } }