Why does my Android App Force Closes but there is no clear error that is causing it?
<p>I have an android application that connects to a remote Apache server on another laptop and it connects just fine for the first few times. Then now I get a force close window but nothing has been changed.</p>

<p>Here is the activity that force closes</p>

<pre><code>package com.thesis.menubook;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.thesis.menubook.JSONParser;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class ChooseTable extends Activity {

    DBConnect db = new DBConnect(this);

    EditText tableNumber;
    Button btnGo;
    String table_ID;
    String table_availability;

 // Progress Dialog
    private ProgressDialog pDialog;

    // JSON parser class
    JSONParser jsonParser = new JSONParser();


    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_TABLE = "tabledb";
    private static final String TAG_TABLE_ID = "table_ID";
    private static final String TAG_TABLE_STATUS = "table_status";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_table);

        btnGo = (Button) findViewById(R.id.check_in_button);
        tableNumber = (EditText) findViewById(R.id.table_number);

        btnGo.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {
              table_ID = (tableNumber).getText().toString();
              new GetTableDetails().execute();
              Log.d("Table Status", table_availability);
              if(table_availability == "AVAILABLE")
              {
                  Toast.makeText(ChooseTable.this, table_availability, Toast.LENGTH_LONG).show();
                  Intent i = new Intent (ChooseTable.this, ChooseOrdersMenu.class);
                    startActivity(i);
              }
            }
        });

    }

    /**
     * Background Async Task to Get complete product details
     * */
    class GetTableDetails extends AsyncTask&lt;String, String, String&gt; {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(ChooseTable.this);
            pDialog.setMessage("Checking Table Availability. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Getting product details in background thread
         * */
        protected String doInBackground(String... params) {

            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    // Check for success tag
                    int success;
                    try {
                        // Building Parameter
                        List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
                        params.add(new BasicNameValuePair(TAG_TABLE_ID, table_ID));
                        //ipaddress of server
                        String ipaddress = "";
                        try
                        {
                            db.open();
                            ipaddress=db.getIP();
                            Log.d("IP Address", ipaddress);
                        }
                        catch(Exception ex)
                        {
                            ex.printStackTrace();
                        }
                        finally
                        {
                            db.close();
                        }

                        if(ipaddress != "-1")
                        {
                        // single table url
                        String url_table_details = "http://"+ipaddress+":80/MenuBook/checkTable.php";
                        Log.d("URL", url_table_details);
                        // getting product details by making HTTP request
                        // Note that product details url will use GET request
                        JSONObject json = jsonParser.makeHttpRequest(
                                url_table_details, "GET", params);

                        // check your log for json response
                        Log.d("Check Table", json.toString());

                        // json success tag
                        success = json.getInt(TAG_SUCCESS);
                        if (success == 1) {
                            // successfully received table details
                            JSONArray tableObj = json
                                    .getJSONArray(TAG_TABLE); // JSON Array

                            // get table availability from JSON Array
                            JSONObject table = tableObj.getJSONObject(0);
                            table_availability = table.getString(TAG_TABLE_STATUS);


                        }else{
                            table_availability = "TABLE NOT FOUND";
                        }
                        }
                        else
                        {
                            table_availability = "FAILED TO RETRIEVE SERVER IP ADDRESS";
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {

            pDialog.dismiss();

        }
    }

}
</code></pre>

<p>Here is the activity that calls the previous activity </p>

<pre><code>package com.thesis.menubook;



import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class IPAddress extends Activity {

    DBConnect db = new DBConnect(this);
    String ip;
    Boolean next = false;

    EditText ipaddress;
    Button connect;

    // Progress Dialog
    private ProgressDialog pDialog;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ipaddress);

        connect = (Button) findViewById(R.id.connectBtn);


        connect.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                    ipaddress = (EditText) findViewById(R.id.ipAddress);
                    ip = ipaddress.getText().toString();
                    new InsertIPAddress().execute();
                    if(next == true)
                    {
                        Intent i = new Intent (IPAddress.this, ChooseTable.class);
                        startActivity(i);
                    }
                }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_ipaddress, menu);
        return true;
    }

     /**
     * Background Async Task to Insert IP address
     * */
    class InsertIPAddress extends AsyncTask&lt;String, String, String&gt; {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(IPAddress.this);
            pDialog.setMessage("Connecting to Server. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Inserting IPAddress in background thread
         * */
        protected String doInBackground(String... params) {

            runOnUiThread(new Runnable() {
                public void run() {

                    pDialog.setMessage("Saving IP Address. Please wait...");
                    long id = 0;
                    if((ip == "") || (ip.contains(" ") == true))
                    {
                        Toast.makeText(IPAddress.this, "Please enter the server IP address and/or remove spaces.", Toast.LENGTH_LONG).show();
                        next = false;
                    }
                    else
                    {
                        try 
                        {
                            db.open();
                            id = db.insertIPAddress(ip);    
                        } 
                        catch (Exception e) 
                        {
                            e.printStackTrace();
                        }
                        finally
                        {
                            db.close();
                        }
                        Toast.makeText(IPAddress.this, "Inserted at row "+id , Toast.LENGTH_LONG).show();
                        next = true;
                    }
                }
            });

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            pDialog.dismiss();
        }
    }

}
</code></pre>

<p>And here is my LogCat :</p>

<pre><code>01-31 21:30:59.082: W/KeyCharacterMap(588): No keyboard for id 0
01-31 21:30:59.082: W/KeyCharacterMap(588): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-31 21:31:20.982: D/AndroidRuntime(588): Shutting down VM
01-31 21:31:20.982: W/dalvikvm(588): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-31 21:31:20.991: E/AndroidRuntime(588): FATAL EXCEPTION: main
01-31 21:31:20.991: E/AndroidRuntime(588): java.lang.NullPointerException: println needs a message
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.util.Log.println_native(Native Method)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.util.Log.d(Log.java:122)
01-31 21:31:20.991: E/AndroidRuntime(588):  at com.thesis.menubook.ChooseTable$1.onClick(ChooseTable.java:60)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.view.View.performClick(View.java:2408)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.view.View$PerformClick.run(View.java:8816)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.os.Handler.handleCallback(Handler.java:587)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.os.Looper.loop(Looper.java:123)
01-31 21:31:20.991: E/AndroidRuntime(588):  at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 21:31:20.991: E/AndroidRuntime(588):  at java.lang.reflect.Method.invokeNative(Native Method)
01-31 21:31:20.991: E/AndroidRuntime(588):  at java.lang.reflect.Method.invoke(Method.java:521)
01-31 21:31:20.991: E/AndroidRuntime(588):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 21:31:20.991: E/AndroidRuntime(588):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 21:31:20.991: E/AndroidRuntime(588):  at dalvik.system.NativeStart.main(Native Method)
01-31 21:31:23.643: I/Process(588): Sending signal. PID: 588 SIG: 9
</code></pre>
