0

我尝试将 AsyncHttpResponseHandler 的响应字符串存储在这样的类变量中:

public boolean isLatestVersion = true;

private void requestServerVersionFile() {
    AsyncHttpClient client = new AsyncHttpClient();
    client.get(appVersionCheckUrl, new AsyncHttpResponseHandler() {

        @Override
        public void onSuccess(String appVersionCodeServer) {
            Log.e(LOG_TAG, appVersionCheckUrl + " = " + appVersionCodeServer);
            int iResponse = Integer.parseInt(appVersionCodeServer.trim());
            if(iResponse > appVersionCode)
            {
                isLatestVersion = false; //<<< tried this. and self. before
            }
        }

    });
}

...但isLatestVersion 保持真实。覆盖此变量的正确/最聪明的方法是什么?

4

1 回答 1

0

我通过使用嵌套类(http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html)解决了这些问题

于 2014-01-25T06:39:21.540 回答