0

http 投稿でパラメーターを取得していたときに、JsonException.

以下にコードを示します。

protected ArrayList<String> doInBackground(ArrayList<String>... params) {

        ArrayList<String> nameSuccess = new ArrayList<String>();
        HttpClient httpclient = new DefaultHttpClient();
        GeneralConstans GC = new GeneralConstans();
        HttpPost httpget = new HttpPost(GC.PasswordUrl);
        HttpResponse response;
        String result = null;
        try {

            HttpContext ctx = new BasicHttpContext();

            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                    2);
            nameValuePairs.add(new BasicNameValuePair("otpPwd", EdtText
                    .getText().toString()));
            httpget.setEntity(new UrlEncodedFormEntity(nameValuePairs,
                    "UTF-8"));

            response = httpclient.execute(httpget, ctx);
            HttpEntity resEntity = response.getEntity();

            if (resEntity != null) {
                result = EntityUtils.toString(resEntity);
                JSONObject arr = new JSONObject(result);

                name = (arr.get("name")).toString();
                error = (arr.get("error")).toString();
                nameSuccess.add(0, name);
                nameSuccess.add(1, error);
            }
            return nameSuccess;


        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

JSONObject arr = new JSONObject(result);例外が発生している行で。

私はAndroidプログラミングが初めてです。

loccat : 08-14 16:23:59.388: E/WindowManager(10626): アクティビティ tr.com.turkcell.shmobile.PasswordConfirmationActivity が、最初に追加されたウィンドウ com.android.internal.policy.impl.PhoneWindow$DecorView@414fa9e0 をリークしましたここ 08-14 16:23:59.388: E/WindowManager(10626): android.view.WindowLeaked: アクティビティ tr.com.turkcell.shmobile.PasswordConfirmationActivity がウィンドウ com.android.internal.policy.impl.PhoneWindow$DecorView@ をリークしました最初にここに追加された 414fa9e0 08-14 16:23:59.388: E/WindowManager(10626): android.view.ViewRootImpl.(ViewRootImpl.java:374) 08-14 16:23:59.388: E/WindowManager(10626) ): android.view.WindowManagerImpl.addView(WindowManagerImpl.java:292) 08-14 16:23:59.388: E/WindowManager(10626): android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224) 08- 14 16:23:59.388: E/WindowManager(10626):android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149) 08-14 16:23:59.388: E/WindowManager(10626): android.view.Window$LocalWindowManager.addView(Window.java:549) で08-14 16:23:59.388: E/WindowManager(10626): android.app.Dialog.show(Dialog.java:277) 08-14 16:23:59.388: E/WindowManager(10626): Android で。 app.ProgressDialog.show(ProgressDialog.java:116) 08-14 16:23:59.388: E/WindowManager(10626): android.app.ProgressDialog.show(ProgressDialog.java:99) 08-14 16:23: 59.388: E/WindowManager(10626): android.app.ProgressDialog.show(ProgressDialog.java:94) 08-14 16:23:59.388: E/WindowManager(10626): tr.com.turkcell.shmobile.PasswordConfirmationActivity で$GetName.onPreExecute(PasswordConfirmationActivity.java:140) 08-14 16:23:59.388: E/WindowManager(10626): android.os.AsyncTask で。executeOnExecutor(AsyncTask.java:586) 08-14 16:23:59.388: E/WindowManager(10626): android.os.AsyncTask.execute(AsyncTask.java:534) 08-14 16:23:59.388: E/ WindowManager(10626): tr.com.turkcell.shmobile.PasswordConfirmationActivity$1$1.run(PasswordConfirmationActivity.java:53) 08-14 16:23:59.388: E/WindowManager(10626): android.app.Activity.runOnUiThread で(Activity.java:4591) 08-14 16:23:59.388: E/WindowManager(10626): tr.com.turkcell.shmobile.PasswordConfirmationActivity$1.onClick(PasswordConfirmationActivity.java:50) 08-14 16:23: 59.388: E/WindowManager(10626): android.view.View.performClick(View.java:4084) 08-14 16:23:59.388: E/WindowManager(10626): android.view.View$PerformClick.run で(View.java:16966) 08-14 16:23:59.388: E/WindowManager(10626): android.os.Handler.handleCallback(Handler.java:615) 08-14 16:23:59.388: E/WindowManager(10626): android.os.Handler.dispatchMessage(Handler.java:92) 08-14 16:23:59.388: E/WindowManager(10626): でandroid.os.Looper.loop(Looper.java:137) 08-14 16:23:59.388: E/WindowManager(10626): android.app.ActivityThread.main(ActivityThread.java:4754) 08-14 16: 23:59.388: E/WindowManager(10626): java.lang.reflect.Method.invokeNative(Native Method) 08-14 16:23:59.388: E/WindowManager(10626): java.lang.reflect.Method で。 (Method.java:511) 08-14 16:23:59.388: E/WindowManager(10626): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 08-14 16: 23:59.388: E/WindowManager(10626): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 08-14 16:23:59.388: E/WindowManager(10626): dalvik.system で.NativeStart.main(Native Method) 08-14 16:24:00.788: W/System.err(10626): org.json.JSONException: 値 (JSONObject.java:158) 08-14 16:24:00.788: W/System.エラー (10626): org.json.JSONObject.(JSONObject.java:171) 08-14 16:24:00.788: W/System.err(10626): tr.com.turkcell.shmobile.PasswordConfirmationActivity$GetName で。 doInBackground(PasswordConfirmationActivity.java:102) 08-14 16:24:00.798: W/System.err(10626): tr.com.turkcell.shmobile.PasswordConfirmationActivity$GetName.doInBackground(PasswordConfirmationActivity.java:1) 08-14 で16:24:00.798: W/System.err(10626): android.os.AsyncTask$2.call(AsyncTask.java:287) 08-14 16:24:00.798: W/System.err(10626): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 08-14 16:24:00.798: W/System.err(10626): java.util.concurrent.FutureTask.run(FutureTask.java で:137) 08-14 16:24:00.798:W/System.err(10626): android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 08-14 16:24:00.798: W/System.err(10626): java.util で。並行.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 08-14 16:24:00.798: W/System.err(10626): java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) で

4

1 に答える 1