线程那些事

new Thread() {
			public void run() {
				while (true) {
					try {
						if (!conditionFlag) {
							conditionNumIndex = 0;
						} else {
							conditionNumIndex++;
							if (conditionNumIndex == 6) {
								conditionNumIndex = 5;
							}
						}
						Thread.sleep(100);//30
					} catch (Exception e) {
						// TODO: handle exception
						e.printStackTrace();
					}
				}
			};
		}.start();



if (conditionNumIndex == 6) {
conditionNumIndex = 5;
}此条件不可省略,否则程序会终止运行,因为能加载的图片只有六张。

原文地址:https://www.cnblogs.com/Anzhongliu/p/6092063.html