1
我對我的代碼塊有一些疑問。我試着在Netbeans上運行它,它似乎並不喜歡Google Glass上的這段代碼。我使用Eclipse編譯它,它似乎也正確編譯。Glass Throwing Error
package com.openglassquartz.helloglass;
import java.io.IOException;
import java.net.URL;
import java.util.Scanner;
public class OnlineRetrieval {
boolean activeGame;
public boolean checkGame() { //Method for which to check if there is a current game going on.
try {
URL url = new URL("http://danielchan.me/league/active.txt");
Scanner s = new Scanner(url.openStream()); //All errors point to this line of code??
int temporary_Reading = s.nextInt();
if(temporary_Reading == 1) {
return activeGame = true;
} else {
return activeGame = false;
}
} catch(IOException ex) {
ex.printStackTrace();
}
return activeGame;
}
}
來自LaunchService類。
OnlineRetrieval OR = new OnlineRetrieval();
boolean temp_Check = OR.checkGame();
01-14 16:38:32.187: E/AndroidRuntime(18639): at com.openglassquartz.helloglass.OnlineRetrieval.checkGame(OnlineRetrieval.java:20)
01-14 16:38:32.187: E/AndroidRuntime(18639): at com.openglassquartz.helloglass.CardLaunchService.onStartCommand(CardLaunchService.java:77)
我該如何解決這個問題?它似乎在Netbeans上工作時,我嘗試輸出它,但不是在谷歌眼鏡。
是的,我看到了我的錯誤。似乎我有很高的閱讀能力來做哈哈。非常感謝! – HelloWorld