• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Tic Tac Toe Problems

motowater

Lurker
Hey guys. I'm making a tic tac toe game for my android and I'm having a hard time trying to find out why it is getting errors when trying to contact my server.

Here is my code:
Code:
public void createGame(View button){
        try{
            HttpClient httpClient = new DefaultHttpClient();
            HttpContext localContext = new BasicHttpContext();
            HttpGet httpGet = new HttpGet("http://www.spartanjava.com");
            HttpResponse response = httpClient.execute(httpGet, localContext);
            String result = "";
             
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(
                  response.getEntity().getContent()
                )
              );
            String line = reader.readLine();
            System.out.println(line);
        }
        catch(Exception e){
            Log.e(e.getClass().getName(), e.getMessage(), e);
        }

    }

What happens is whether using this method or URLConnection it doesn't seem to want to open a working BufferedReader. When I debug and step into each line it is at that point where it catches an exception, but I still don't know what the error is. I am running this on an android virtual device so maybe it is because of an internet problem?

Does anyone know a simple way to test BufferedReader? Also how do I use logcat? I found this exception code online and it does not seem to want to print my error.
 
Back
Top Bottom