Question

I try to store the response string of the AsyncHttpResponseHandler in a class variable like this:

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
            }
        }

    });
}

... but isLatestVersion stays true. What is the correct / smartest way to overwrite this variable?

Was it helpful?

Solution

I solved the stuff by using Nested Classes (http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top