0
因此,我在網上搜索了一段時間,現在我感到困惑......我需要在代碼執行後線程明確結束線程還是線程自動執行線程?
代碼:Android執行代碼後線程自行結束
Runnable waitForInput = new Runnable() {
public void run() {
while (!inputOK) {
try {
Thread.sleep(100);
} catch (Exception e) {}
}
if (!ret_val.equals("")) {
port = ret_val;
}
inputOK = false;
ret_val = "";
}
};
Thread inputW = new Thread(waitForInput);
inputW.start();