2013-08-27 468 views
0

我已經寫了下面的代碼來讀取並顯示我的android應用程序中的html文件。但該活動並未開始。它顯示「不幸的應用程序停止工作」。 Java類如下:啓動Android活動時出錯

package com.radiobot.speedreaderv1_1; 

import java.io.BufferedReader; 
import java.io.File; 
import java.io.FileReader; 
import java.io.IOException; 

import android.app.Activity; 
import android.os.Bundle; 
import android.os.Environment; 
import android.webkit.WebView; 
import android.widget.TextView; 

public class htmlViewer extends Activity { 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.htmlviewer); 
     WebView wv = (WebView) findViewById(R.id.webView1); 

     TextView tv = (TextView)findViewById(R.id.fileContent); 

     File dir = Environment.getExternalStorageDirectory(); 

    // Bundle extras = getIntent().getExtras(); 

     //  String newloc = extras.getString("loc"); 






     File file = new File(dir,"test.html"); 


     if(file.exists()) 
     { 

      StringBuilder text = new StringBuilder(); 

      try { 
       BufferedReader br = new BufferedReader(new FileReader(file)); 
       String line; 

       while ((line = br.readLine()) != null) { 
        text.append(line); 
        text.append('\n'); 
       } 
      } 
      catch (IOException e) { 

      } 
      // tv.setText(text); 
      String html = text.toString(); 
      String mimeType = "text/html"; 
      String encoding = "UTF-8"; 
      wv.loadDataWithBaseURL("",html, mimeType, encoding, ""); 

     } 
     else 
     { 
     tv.setText("Sorry file doesn't exist!!"); 
     } 

    } 

} 

而且logcat的情況如下:

08-27 21:21:56.916: I/ActivityManager(286): START u0 {cmp=com.radiobot.speedreaderv1_1/.htmlViewer (has extras)} from pid 1073 
08-27 21:21:56.936: W/WindowManager(286): Failure taking screenshot for (246x410) to layer 21015 
08-27 21:21:57.367: D/AndroidRuntime(1073): Shutting down VM 
08-27 21:21:57.367: W/dalvikvm(1073): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 
08-27 21:21:57.517: E/AndroidRuntime(1073): FATAL EXCEPTION: main 
08-27 21:21:57.517: E/AndroidRuntime(1073): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.htmlViewer}: java.lang.NullPointerException 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.os.Handler.dispatchMessage(Handler.java:99) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.os.Looper.loop(Looper.java:137) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread.main(ActivityThread.java:5041) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at java.lang.reflect.Method.invokeNative(Native Method) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at java.lang.reflect.Method.invoke(Method.java:511) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at dalvik.system.NativeStart.main(Native Method) 
08-27 21:21:57.517: E/AndroidRuntime(1073): Caused by: java.lang.NullPointerException 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at com.radiobot.speedreaderv1_1.htmlViewer.onCreate(htmlViewer.java:58) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.Activity.performCreate(Activity.java:5104) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
08-27 21:21:57.517: E/AndroidRuntime(1073):  ... 11 more 
08-27 21:21:57.677: W/ActivityManager(286): Force finishing activity com.radiobot.speedreaderv1_1/.htmlViewer 
08-27 21:21:57.687: W/ActivityManager(286): Force finishing activity com.radiobot.speedreaderv1_1/.FileManager 
08-27 21:21:58.196: W/ActivityManager(286): Activity pause timeout for ActivityRecord{4104a8e0 u0 com.radiobot.speedreaderv1_1/.htmlViewer} 
08-27 21:21:58.387: I/Choreographer(286): Skipped 69 frames! The application may be doing too much work on its main thread. 
08-27 21:21:58.437: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property 
08-27 21:22:00.436: I/Choreographer(402): Skipped 31 frames! The application may be doing too much work on its main thread. 
08-27 21:22:01.666: I/Process(1073): Sending signal. PID: 1073 SIG: 9 
08-27 21:22:01.737: I/ActivityManager(286): Process com.radiobot.speedreaderv1_1 (pid 1073) has died. 
08-27 21:22:01.737: W/InputDispatcher(286): channel '40f4db50 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.Home (server)' ~ Consumer closed input channel or an error occurred. events=0x9 
08-27 21:22:01.756: E/InputDispatcher(286): channel '40f4db50 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.Home (server)' ~ Channel is unrecoverably broken and will be disposed! 
08-27 21:22:01.756: W/InputDispatcher(286): channel '40f70d70 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.FileManager (server)' ~ Consumer closed input channel or an error occurred. events=0x9 
08-27 21:22:01.756: E/InputDispatcher(286): channel '40f70d70 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.FileManager (server)' ~ Channel is unrecoverably broken and will be disposed! 
08-27 21:22:01.796: I/WindowState(286): WIN DEATH: Window{40f4db50 u0 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.Home} 
08-27 21:22:01.796: W/InputDispatcher(286): Attempted to unregister already unregistered input channel '40f4db50 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.Home (server)' 
08-27 21:22:01.806: I/WindowState(286): WIN DEATH: Window{40f70d70 u0 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.FileManager} 
08-27 21:22:01.806: W/InputDispatcher(286): Attempted to unregister already unregistered input channel '40f70d70 com.radiobot.speedreaderv1_1/com.radiobot.speedreaderv1_1.FileManager (server)' 
08-27 21:22:01.856: D/dalvikvm(1090): Not late-enabling CheckJNI (already on) 
08-27 21:22:01.896: I/ActivityManager(286): Start proc com.radiobot.speedreaderv1_1 for activity com.radiobot.speedreaderv1_1/.Home: pid=1090 uid=10046 gids={50046, 3003, 1028} 
08-27 21:22:01.976: I/dalvikvm(286): Jit: resizing JitTable from 8192 to 16384 
08-27 21:22:02.146: I/Choreographer(286): Skipped 72 frames! The application may be doing too much work on its main thread. 
08-27 21:22:02.286: I/Choreographer(286): Skipped 35 frames! The application may be doing too much work on its main thread. 
08-27 21:22:02.326: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property 
08-27 21:22:02.587: I/Choreographer(286): Skipped 68 frames! The application may be doing too much work on its main thread. 
08-27 21:22:02.706: E/Trace(1090): error opening trace file: No such file or directory (2) 
08-27 21:22:02.787: I/Choreographer(286): Skipped 50 frames! The application may be doing too much work on its main thread. 
08-27 21:22:03.556: D/dalvikvm(1090): GC_FOR_ALLOC freed 69K, 8% free 2498K/2688K, paused 50ms, total 52ms 
08-27 21:22:03.576: I/dalvikvm-heap(1090): Grow heap (frag case) to 3.141MB for 614416-byte allocation 
08-27 21:22:03.698: D/dalvikvm(1090): GC_FOR_ALLOC freed 2K, 6% free 3096K/3292K, paused 120ms, total 120ms 
08-27 21:22:03.806: D/dalvikvm(1090): GC_CONCURRENT freed <1K, 5% free 3131K/3292K, paused 10ms+6ms, total 109ms 
08-27 21:22:04.126: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property 
08-27 21:22:04.207: W/InputMethodManagerService(286): Got RemoteException sending setActive(false) notification to pid 1073 uid 10046 
08-27 21:22:04.256: I/Choreographer(1090): Skipped 34 frames! The application may be doing too much work on its main thread. 
08-27 21:22:04.286: D/gralloc_goldfish(1090): Emulator without GPU emulation detected. 
08-27 21:22:04.496: I/ActivityManager(286): Displayed com.radiobot.speedreaderv1_1/.Home: +2s674ms (total +7s519ms) 
08-27 21:22:31.388: D/ExchangeService(633): Received deviceId from Email app: null 
08-27 21:22:31.388: D/ExchangeService(633): !!! deviceId unknown; stopping self and retrying 
08-27 21:22:36.507: D/ExchangeService(633): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false 
08-27 21:22:36.507: D/ExchangeService(633): !!! EAS ExchangeService, onCreate 
08-27 21:22:36.527: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
08-27 21:22:36.536: D/ExchangeService(633): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false 
08-27 21:22:36.547: D/ExchangeService(633): !!! Email application not found; stopping self 
08-27 21:22:36.566: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
08-27 21:22:36.586: E/ActivityThread(633): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26980 that was originally bound here 
08-27 21:22:36.586: E/ActivityThread(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26980 that was originally bound here 
08-27 21:22:36.586: E/ActivityThread(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:22:36.586: E/ActivityThread(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:22:36.586: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:22:36.586: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:22:36.586: E/ActivityThread(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:22:36.586: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:22:36.586: E/ActivityThread(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:22:36.586: E/ActivityThread(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:22:36.586: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:22:36.586: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:22:36.586: E/ActivityThread(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:22:36.686: E/StrictMode(633): null 
08-27 21:22:36.686: E/StrictMode(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26980 that was originally bound here 
08-27 21:22:36.686: E/StrictMode(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:22:36.686: E/StrictMode(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:22:36.686: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:22:36.686: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:22:36.686: E/StrictMode(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:22:36.686: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:22:36.686: E/StrictMode(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:22:36.686: E/StrictMode(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:22:36.686: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:22:36.686: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:22:36.686: E/StrictMode(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:22:36.696: W/ActivityManager(286): Unbind failed: could not find connection for [email protected] 
08-27 21:22:36.717: E/ActivityThread(633): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26338 that was originally bound here 
08-27 21:22:36.717: E/ActivityThread(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26338 that was originally bound here 
08-27 21:22:36.717: E/ActivityThread(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:22:36.717: E/ActivityThread(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:22:36.717: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:22:36.717: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:22:36.717: E/ActivityThread(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:22:36.717: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:22:36.717: E/ActivityThread(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:22:36.717: E/ActivityThread(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:22:36.717: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:22:36.717: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:22:36.717: E/ActivityThread(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:22:36.827: E/StrictMode(633): null 
08-27 21:22:36.827: E/StrictMode(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]26338 that was originally bound here 
08-27 21:22:36.827: E/StrictMode(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:22:36.827: E/StrictMode(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:22:36.827: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:22:36.827: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:22:36.827: E/StrictMode(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:22:36.827: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:22:36.827: E/StrictMode(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:22:36.827: E/StrictMode(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:22:36.827: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:22:36.827: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:22:36.827: E/StrictMode(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:22:36.846: W/ActivityManager(286): Unbind failed: could not find connection for [email protected] 
08-27 21:22:36.846: D/dalvikvm(633): GC_CONCURRENT freed 463K, 20% free 2482K/3072K, paused 77ms+79ms, total 252ms 
08-27 21:23:21.586: D/ExchangeService(633): Received deviceId from Email app: null 
08-27 21:23:21.586: D/ExchangeService(633): !!! deviceId unknown; stopping self and retrying 
08-27 21:23:26.696: D/ExchangeService(633): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false 
08-27 21:23:26.716: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
08-27 21:23:26.716: D/ExchangeService(633): !!! Email application not found; stopping self 
08-27 21:23:26.737: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
08-27 21:23:26.766: E/ActivityThread(633): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18878 that was originally bound here 
08-27 21:23:26.766: E/ActivityThread(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18878 that was originally bound here 
08-27 21:23:26.766: E/ActivityThread(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:23:26.766: E/ActivityThread(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:23:26.766: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:23:26.766: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:23:26.766: E/ActivityThread(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:23:26.766: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:23:26.766: E/ActivityThread(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:23:26.766: E/ActivityThread(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:23:26.766: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:23:26.766: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:23:26.766: E/ActivityThread(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:23:26.776: E/StrictMode(633): null 
08-27 21:23:26.776: E/StrictMode(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18878 that was originally bound here 
08-27 21:23:26.776: E/StrictMode(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:23:26.776: E/StrictMode(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:23:26.776: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:23:26.776: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:23:26.776: E/StrictMode(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:23:26.776: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:23:26.776: E/StrictMode(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:23:26.776: E/StrictMode(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:23:26.776: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:23:26.776: E/StrictMode(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:23:26.776: E/StrictMode(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:23:26.786: W/ActivityManager(286): Unbind failed: could not find connection for [email protected] 
08-27 21:23:26.796: E/ActivityThread(633): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18ba8 that was originally bound here 
08-27 21:23:26.796: E/ActivityThread(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18ba8 that was originally bound here 
08-27 21:23:26.796: E/ActivityThread(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:23:26.796: E/ActivityThread(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:23:26.796: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:23:26.796: E/ActivityThread(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:23:26.796: E/ActivityThread(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:23:26.796: E/ActivityThread(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
08-27 21:23:26.796: E/ActivityThread(633): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
08-27 21:23:26.796: E/ActivityThread(633): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
08-27 21:23:26.796: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
08-27 21:23:26.796: E/ActivityThread(633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
08-27 21:23:26.796: E/ActivityThread(633): at java.lang.Thread.run(Thread.java:856) 
08-27 21:23:26.826: E/StrictMode(633): null 
08-27 21:23:26.826: E/StrictMode(633): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]18ba8 that was originally bound here 
08-27 21:23:26.826: E/StrictMode(633): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
08-27 21:23:26.826: E/StrictMode(633): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
08-27 21:23:26.826: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
08-27 21:23:26.826: E/StrictMode(633): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
08-27 21:23:26.826: E/StrictMode(633): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
08-27 21:23:26.826: E/StrictMode(633): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 

請幫我解決這個問題。

+0

wv.loadDataWithBaseURL(「」,html,mimeType,encoding,「」),這一行給出錯誤! –

+0

com.radiobot.speedreaderv1_1.htmlViewer.onCreate(htmlViewer.java:58)? – WindsurferOak

+0

wv.loadDataWithBaseURL(「」,html,mimeType,encoding,「」); for webview –

回答

0

看起來您的findViewbyId爲Webview查找返回null。這意味着它根本找不到資源R.id.webView1。確保你的拼寫和命名是正確的。

+0

謝謝。我忘了在xml文件中創建webview。現在它的工作。 –