0

私はタスクを追加するリストを作成するためにアンドロイドに取り組んでいます。それを実行してエミュレーターを起動すると、多くのエラーが発生します。私はそれらを解決しようとしましたが、できませんでした.1つのクラスの問題は、すべてのタスクを表示することになっていると思います

丸太猫はこちら

04-08 08:53:43.334: E/Trace(637): error opening trace file: No such file or directory (2)
04-08 08:53:45.043: I/Choreographer(637): Skipped 54 frames!  The application may be doing too much work on its main thread.
04-08 08:53:45.144: D/gralloc_goldfish(637): Emulator without GPU emulation detected.
04-08 08:53:45.479: I/Choreographer(637): Skipped 35 frames!  The application may be doing too much work on its main thread.
04-08 08:53:46.067: I/Choreographer(637): Skipped 56 frames!  The application may be doing too much work on its main thread.
04-08 08:53:46.713: D/dalvikvm(637): GC_CONCURRENT freed 132K, 2% free 9089K/9268K, paused 9ms+3ms, total 102ms
04-08 08:53:46.803: E/JSON Parser(637): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
04-08 08:53:46.843: W/dalvikvm(637): threadid=11: thread exiting with uncaught exception (group=0x2bd39930)
04-08 08:53:46.903: E/AndroidRuntime(637): FATAL EXCEPTION: AsyncTask #1
04-08 08:53:46.903: E/AndroidRuntime(637): java.lang.RuntimeException: An error occured while executing doInBackground()
04-08 08:53:46.903: E/AndroidRuntime(637):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.FutureTask.run(FutureTask.java:239)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.lang.Thread.run(Thread.java:856)
04-08 08:53:46.903: E/AndroidRuntime(637): Caused by: java.lang.NullPointerException
04-08 08:53:46.903: E/AndroidRuntime(637):  at com.example.checklist.MainTask$LoadAllTasks.doInBackground(MainTask.java:172)
04-08 08:53:46.903: E/AndroidRuntime(637):  at com.example.checklist.MainTask$LoadAllTasks.doInBackground(MainTask.java:1)
04-08 08:53:46.903: E/AndroidRuntime(637):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-08 08:53:46.903: E/AndroidRuntime(637):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-08 08:53:46.903: E/AndroidRuntime(637):  ... 3 more
04-08 08:53:51.744: E/WindowManager(637): Activity com.example.checklist.MainTask has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2c607c90 V.E..... R.....ID 0,0-684,192} that was originally added here
04-08 08:53:51.744: E/WindowManager(637): android.view.WindowLeaked: Activity com.example.checklist.MainTask has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2c607c90 V.E..... R.....ID 0,0-684,192} that was originally added here
04-08 08:53:51.744: E/WindowManager(637):   at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
04-08 08:53:51.744: E/WindowManager(637):   at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
04-08 08:53:51.744: E/WindowManager(637):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.Dialog.show(Dialog.java:281)
04-08 08:53:51.744: E/WindowManager(637):   at com.example.checklist.MainTask$LoadAllTasks.onPreExecute(MainTask.java:155)
04-08 08:53:51.744: E/WindowManager(637):   at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
04-08 08:53:51.744: E/WindowManager(637):   at android.os.AsyncTask.execute(AsyncTask.java:534)
04-08 08:53:51.744: E/WindowManager(637):   at com.example.checklist.MainTask.onCreate(MainTask.java:79)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.Activity.performCreate(Activity.java:5104)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-08 08:53:51.744: E/WindowManager(637):   at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 08:53:51.744: E/WindowManager(637):   at android.os.Looper.loop(Looper.java:137)
04-08 08:53:51.744: E/WindowManager(637):   at android.app.ActivityThread.main(ActivityThread.java:5039)
04-08 08:53:51.744: E/WindowManager(637):   at java.lang.reflect.Method.invokeNative(Native Method)
04-08 08:53:51.744: E/WindowManager(637):   at java.lang.reflect.Method.invoke(Method.java:511)
04-08 08:53:51.744: E/WindowManager(637):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-08 08:53:51.744: E/WindowManager(637):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-08 08:53:51.744: E/WindowManager(637):   at dalvik.system.NativeStart.main(Native Method)
04-08 08:53:51.744: I/Choreographer(637): Skipped 49 frames!  The application may be doing too much work on its main thread.
04-08 08:53:57.493: I/Process(637): Sending signal. PID: 637 SIG: 9
4

1 に答える 1

0

ログに json 解析エラーとそれに続く NPE が表示されていることを考えると、問題は次の場所で発生していると思います。

// getting JSON string from URL 
JSONObject json = jParser.makeHttpRequest(url_all_tasks, "GET", params); 

// Check your log cat for JSON reponse 
Log.d("All Tasks: ", json.toString());

nullパーサーが失敗してfor を返すだけのように見えjson、呼び出しjson.toString()が NPE で失敗します。

またAsyncTask、Sunil Havnur からのコメントに合わせてコードを変更する必要があります。

于 2013-04-08T18:22:51.150 に答える