我在for循环中有一个CountDownTimer,但它不算数。为什么呢?
for (int i = 0; i < payloadList.size(); i++) {
sonpx.dtnsocialnetwork.Bundle bundle = new sonpx.dtnsocialnetwork.Bundle(
srcIMEI, desIMEI, fileName, i, totalFragment,
numOfSendingRest, payloadList.get(i));
byte[][] payload = new byte[1][];
try {
payload[0] = serialize(bundle);
} catch (IOException e) {
e.printStackTrace();
}
Log.i(TAG, "bundle payload size: "+payload[0].length);
mDefaultChannel.sendData(nodeName, DIRECT_BUNDLE, payload);
CountDownTimer countDownTimer = new CountDownTimer(5000, 100) {
@Override
public void onTick(long millisUntilFinished) {
if (bundleResultOk) {
cancel();
bundleResultOk = false;
}
Log.i(TAG, "bundle result: "+bundleResultOk);
}
@Override
public void onFinish() {
counterFinish = true;
Log.i(TAG, "Send Message time out");
}
};
countDownTimer.start();
}
它不会打印Log.i(TAG,&#34;捆绑结果:&#34; + bundleResultOk);