Q:

Boolean method can not return anything

I am working on an Android app, and now I am writing some methods for the login system.  I am trying to create a boolean method that returns true or false according to the response of the server.  This is my code:
public static boolean login(final String name, final String password) {

    final boolean result;
    Thread nt = new Thread() {
        @Override
        public void run() {

            URL url;
            HashMap<String, String> postDataParams = new HashMap<String, String>();

            postDataParams.put("name", name);
            postDataParams.put("password", password);

            try {

                url = new URL("");

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setReadTimeout(15000);
                conn.setConnectTimeout(15000);
                conn.setRequestMethod("POST");
                conn.setDoInput(true);
                conn.setDoOutput(true);

                OutputStream os = conn.getOutputStream();
                BufferedWriter writer = new BufferedWriter(
                        new OutputStreamWriter(os, "UTF-8"));

                writer.flush();
                writer.close();
                os.close();
                int responseCode = conn.getResponseCode();

                if (responseCode == HttpsURLConnection. HTTP_OK) {
                    return true;
                } else {
                    return false;
                }

            } catch (Exception e) {
                return false;
                e.printStackTrace();
            }
        }

    };
    nt.start();
}

The problem is that every return statement gets highlighted because cannot return a value from a method with void result type, something I can not understand, because it is clearly defined as a boolean method.  I suppose, it has something to do with the new thread I created, but since this app will be running on an Android device, I haveve to run my query in a separate thread.   
Thanks in advance! 

A:

All of your code is within the public void run() method, which returns void. 
Therefore returning boolean is not allowed.