在1的字符1输入错误

时间:2014-01-05 18:50:29

标签: java php android

我从mysql数据库中获取记录并将其放入ListView但我收到标题中所述的错误,“输入错误的字符1”。我已经尝试检查与之关联的php文件,但它运行良好并且能够从数据库中获取数据。下面是捕获错误的代码。

public void ListDrawer() {
    List<Map<String, String>> announcementList = new ArrayList<Map<String, String>>();
    HashMap<String, String> listA;
    try {
        JSONObject jsonResponse = new JSONObject(jsonResult);
        JSONArray jsonMainNode = jsonResponse.optJSONArray("myannouncement");

        for (int i = 0; i < jsonMainNode.length(); i++) {
            JSONObject jsonChildNode = jsonMainNode.getJSONObject(i);
            String title = jsonChildNode.optString("title");
            String dated = jsonChildNode.optString("dated");
            String description = jsonChildNode.optString("description");
            String id = jsonChildNode.optString("announcement_id");

            listA = new HashMap<String, String>();
            listA.put("title", title);
            listA.put("dated", dated);
            listA.put("description", description);
            listA.put("id", id);

            announcementList.add(listA);
        }
    } catch (JSONException e) {
        Toast.makeText(this, e.getMessage().toString() + "", Toast.LENGTH_LONG).show();
    }

*

*

01-06 02:12:04.696: W/System.err(557): org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2 refused
    01-06 02:12:04.706: W/System.err(557):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
    01-06 02:12:04.706: W/System.err(557):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    01-06 02:12:04.706: W/System.err(557):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    01-06 02:12:04.706: W/System.err(557):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    01-06 02:12:04.716: W/System.err(557):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    01-06 02:12:04.716: W/System.err(557):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    01-06 02:12:04.716: W/System.err(557):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
    01-06 02:12:04.716: W/System.err(557):  at com.feufern.apms.AnnouncementActivity$JsonReadTask.doInBackground(AnnouncementActivity.java:59)
    01-06 02:12:04.716: W/System.err(557):  at com.feufern.apms.AnnouncementActivity$JsonReadTask.doInBackground(AnnouncementActivity.java:1)
    01-06 02:12:04.726: W/System.err(557):  at android.os.AsyncTask$2.call(AsyncTask.java:264)
    01-06 02:12:04.726: W/System.err(557):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
    01-06 02:12:04.726: W/System.err(557):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    01-06 02:12:04.726: W/System.err(557):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
    01-06 02:12:04.736: W/System.err(557):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    01-06 02:12:04.736: W/System.err(557):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    01-06 02:12:04.736: W/System.err(557):  at java.lang.Thread.run(Thread.java:856)
    01-06 02:12:04.746: W/System.err(557): Caused by: java.net.ConnectException: failed to connect to /10.0.2.2 (port 80): connect failed: ECONNREFUSED (Connection refused)
    01-06 02:12:04.746: W/System.err(557):  at libcore.io.IoBridge.connect(IoBridge.java:114)
    01-06 02:12:04.756: W/System.err(557):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
    01-06 02:12:04.756: W/System.err(557):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
    01-06 02:12:04.756: W/System.err(557):  at java.net.Socket.connect(Socket.java:842)
    01-06 02:12:04.756: W/System.err(557):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
    01-06 02:12:04.756: W/System.err(557):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
    01-06 02:12:04.756: W/System.err(557):  ... 15 more
    01-06 02:12:04.766: W/System.err(557): Caused by: libcore.io.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
    01-06 02:12:04.776: W/System.err(557):  at libcore.io.Posix.connect(Native Method)
    01-06 02:12:04.776: W/System.err(557):  at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:75)
    01-06 02:12:04.776: W/System.err(557):  at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
    01-06 02:12:04.786: W/System.err(557):  at libcore.io.IoBridge.connect(IoBridge.java:112)
    01-06 02:12:04.786: W/System.err(557):  ... 20 more
    01-06 02:12:04.796: D/AndroidRuntime(557): Shutting down VM
    01-06 02:12:04.796: W/dalvikvm(557): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
    01-06 02:12:04.817: E/AndroidRuntime(557): FATAL EXCEPTION: main
    01-06 02:12:04.817: E/AndroidRuntime(557): java.lang.NullPointerException
    01-06 02:12:04.817: E/AndroidRuntime(557):  at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at org.json.JSONTokener.nextValue(JSONTokener.java:94)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at org.json.JSONObject.<init>(JSONObject.java:154)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at org.json.JSONObject.<init>(JSONObject.java:171)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at com.feufern.apms.AnnouncementActivity.ListDrawer(AnnouncementActivity.java:109)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at com.feufern.apms.AnnouncementActivity$JsonReadTask.onPostExecute(AnnouncementActivity.java:90)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at com.feufern.apms.AnnouncementActivity$JsonReadTask.onPostExecute(AnnouncementActivity.java:1)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.os.AsyncTask.finish(AsyncTask.java:602)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.os.AsyncTask.access$600(AsyncTask.java:156)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.os.Handler.dispatchMessage(Handler.java:99)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.os.Looper.loop(Looper.java:137)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at android.app.ActivityThread.main(ActivityThread.java:4340)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at java.lang.reflect.Method.invokeNative(Native Method)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at java.lang.reflect.Method.invoke(Method.java:511)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    01-06 02:12:04.817: E/AndroidRuntime(557):  at dalvik.system.NativeStart.main(Native Method)

*

*

0 个答案:

没有答案