通过JsInterface更改活动

时间:2013-05-30 14:09:32

标签: android android-jsinterface

和平在你身上。

我正在为一个Web视图应用程序工作,并希望通过JavaScript更改活动。

首先,我为我的WebView添加了一个JavascriptInterface:

wv.addJavascriptInterface(new JsInterface(this), "android");

这是班级:

public class JsInterface{
    private Activity mContext;

    JsInterface(Activity c) {
        mContext = c;
    }

     public void changeVisibility(){
         wv = (WebView) mContext.findViewById(R.id.wv);
         wv.setVisibility(View.GONE);
     }

}

当JavaScript调用android.changeVisibility()时,我的应用程序崩溃了。

在活动类

中设置了wv
WebView wv;

我可以通过JavaScript更改活动中的任何其他视图(例如Buttons和EditTexts)吗?

抱歉我的英语不好。

更新: LogCat

05-31 10:03:37.935: WARN/dalvikvm(8963): JNI WARNING: JNI method called with exception pending
05-31 10:03:37.935: WARN/dalvikvm(8963):              in Landroid/webkit/JWebCoreJavaBridge;.sharedTimerFired:()V (NewLocalRef)
05-31 10:03:37.945: WARN/dalvikvm(8963): Pending exception is:
05-31 10:03:37.955: INFO/dalvikvm(8963): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4039)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:709)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.955: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:268)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.view.View.requestLayout(View.java:12675)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.view.View.setFlags(View.java:6720)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.view.View.setVisibility(View.java:4617)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at im.myApp.Me.home$JsInterface.changeVisibility(home.java:176)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:92)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108)
05-31 10:03:37.966: INFO/dalvikvm(8963):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 10:03:37.975: INFO/dalvikvm(8963):     at android.os.Looper.loop(Looper.java:137)
05-31 10:03:37.975: INFO/dalvikvm(8963):     at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
05-31 10:03:37.975: INFO/dalvikvm(8963):     at java.lang.Thread.run(Thread.java:856)
05-31 10:03:37.975: INFO/dalvikvm(8963): "WebViewCoreThread" prio=5 tid=11 NATIVE
05-31 10:03:37.975: INFO/dalvikvm(8963):   | group="main" sCount=0 dsCount=0 obj=0x412d10d8 self=0x1b0180
05-31 10:03:37.985: INFO/dalvikvm(8963):   | sysTid=8977 nice=-1 sched=0/0 cgrp=default handle=1770960
05-31 10:03:37.985: INFO/dalvikvm(8963):   | schedstat=( 12912140103 5743020754 1547 ) utm=1204 stm=87 core=0
05-31 10:03:37.985: INFO/dalvikvm(8963):   at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
05-31 10:03:37.985: INFO/dalvikvm(8963):   at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:92)
05-31 10:03:37.985: INFO/dalvikvm(8963):   at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108)
05-31 10:03:37.995: INFO/dalvikvm(8963):   at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 10:03:37.995: INFO/dalvikvm(8963):   at android.os.Looper.loop(Looper.java:137)
05-31 10:03:38.005: INFO/dalvikvm(8963):   at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
05-31 10:03:38.005: INFO/dalvikvm(8963):   at java.lang.Thread.run(Thread.java:856)
05-31 10:03:38.005: ERROR/dalvikvm(8963): VM aborting
05-31 10:03:38.005: ERROR/dalvikvm(8963): [ 05-31 10:03:38.015  8963:0x2311 F/libc     ]
05-31 10:03:38.005: ERROR/dalvikvm(8963): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
05-31 10:03:38.635: INFO/DEBUG(33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-31 10:03:38.635: INFO/DEBUG(33): Build fingerprint: 'generic/sdk/generic:4.0.4/MR1/302030:eng/test-keys'
05-31 10:03:38.645: INFO/DEBUG(33): pid: 8963, tid: 8977  >>> im.myApp.Me <<<
05-31 10:03:38.645: INFO/DEBUG(33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
05-31 10:03:38.655: INFO/DEBUG(33):  r0 00000000  r1 0009e190  r2 00000000  r3 00000000
05-31 10:03:38.655: INFO/DEBUG(33):  r4 deadd00d  r5 40872c58  r6 0000020c  r7 00000000
05-31 10:03:38.655: INFO/DEBUG(33):  r8 fffffffa  r9 ffffffff  10 00000000  fp 48004c04
05-31 10:03:38.655: INFO/DEBUG(33):  ip 00000000  sp 480048d8  lr 4080bccf  pc 4080bcce  cpsr 60000030
05-31 10:03:38.655: INFO/DEBUG(33):  d0  408f400000000000  d1  4974240000000008
05-31 10:03:38.655: INFO/DEBUG(33):  d2  3f80000042780000  d3  4278000042780000
05-31 10:03:38.655: INFO/DEBUG(33):  d4  3f80000040c00000  d5  412cbedc00000000
05-31 10:03:38.655: INFO/DEBUG(33):  d6  3fee2452c59fb1e2  d7  c01968a380000000
05-31 10:03:38.665: INFO/DEBUG(33):  d8  bf7a04c000000000  d9  41d46a16567be093
05-31 10:03:38.665: INFO/DEBUG(33):  d10 0000000000000000  d11 0000000000000000
05-31 10:03:38.665: INFO/DEBUG(33):  d12 0000000000000000  d13 0000000000000000
05-31 10:03:38.665: INFO/DEBUG(33):  d14 0000000000000000  d15 0000000000000000
05-31 10:03:38.665: INFO/DEBUG(33):  scr 20000013
05-31 10:03:38.915: INFO/DEBUG(33):          #00  pc 00050cce  /system/lib/libdvm.so (dvmAbort)
05-31 10:03:38.915: INFO/DEBUG(33):          #01  pc 000448ae  /system/lib/libdvm.so
05-31 10:03:38.915: INFO/DEBUG(33):          #02  pc 000456fe  /system/lib/libdvm.so
05-31 10:03:38.915: INFO/DEBUG(33):          #03  pc 0004763c  /system/lib/libdvm.so
05-31 10:03:38.915: INFO/DEBUG(33):          #04  pc 0027c162  /system/lib/libwebcore.so
05-31 10:03:38.925: INFO/DEBUG(33):          #05  pc 00278344  /system/lib/libwebcore.so
05-31 10:03:38.925: INFO/DEBUG(33):          #06  pc 001979d4  /system/lib/libwebcore.so
05-31 10:03:38.925: INFO/DEBUG(33): code around pc:
05-31 10:03:38.925: INFO/DEBUG(33): 4080bcac 34b4f8d3 ec48f7cd 26001e73 2f01f813  ...4..H.s..&.../
05-31 10:03:38.925: INFO/DEBUG(33): 4080bcbc 42abb152 d0074416 4798e7f8 f7ff4c0a  R..B.D.....G.L..
05-31 10:03:38.925: INFO/DEBUG(33): 4080bccc 7026ffa7 ec3ef7cd 2006490c 44794a0c  ..&p..>..I. .JyD
05-31 10:03:38.925: INFO/DEBUG(33): 4080bcdc f7cd447a 2000eaf4 ebb6f7cd 58e54b05  zD..... .....K.X
05-31 10:03:38.925: INFO/DEBUG(33): 4080bcec 2b006c6b e7e9d1e9 deadd00d 0006230c  kl.+.........#..
05-31 10:03:38.925: INFO/DEBUG(33): code around lr:
05-31 10:03:38.935: INFO/DEBUG(33): 4080bcac 34b4f8d3 ec48f7cd 26001e73 2f01f813  ...4..H.s..&.../
05-31 10:03:38.935: INFO/DEBUG(33): 4080bcbc 42abb152 d0074416 4798e7f8 f7ff4c0a  R..B.D.....G.L..
05-31 10:03:38.935: INFO/DEBUG(33): 4080bccc 7026ffa7 ec3ef7cd 2006490c 44794a0c  ..&p..>..I. .JyD
05-31 10:03:38.935: INFO/DEBUG(33): 4080bcdc f7cd447a 2000eaf4 ebb6f7cd 58e54b05  zD..... .....K.X
05-31 10:03:38.935: INFO/DEBUG(33): 4080bcec 2b006c6b e7e9d1e9 deadd00d 0006230c  kl.+.........#..
05-31 10:03:38.935: INFO/DEBUG(33): memory map around addr deadd00d:
05-31 10:03:38.945: INFO/DEBUG(33): be89f000-be8b4000 [stack]
05-31 10:03:38.945: INFO/DEBUG(33): (no map for address)
05-31 10:03:38.945: INFO/DEBUG(33): (no map above)
05-31 10:03:38.945: INFO/DEBUG(33): stack:
05-31 10:03:38.945: INFO/DEBUG(33):     48004898  00000000  
05-31 10:03:38.945: INFO/DEBUG(33):     4800489c  4001df59  /system/lib/libc.so
05-31 10:03:38.945: INFO/DEBUG(33):     480048a0  4004770c  /system/lib/libc.so
05-31 10:03:38.945: INFO/DEBUG(33):     480048a4  4004c85c  
05-31 10:03:38.945: INFO/DEBUG(33):     480048a8  00000000  
05-31 10:03:38.945: INFO/DEBUG(33):     480048ac  4001f161  /system/lib/libc.so
05-31 10:03:38.945: INFO/DEBUG(33):     480048b0  4004755c  /system/lib/libc.so
05-31 10:03:38.945: INFO/DEBUG(33):     480048b4  00000000  
05-31 10:03:38.945: INFO/DEBUG(33):     480048b8  0000020c  
05-31 10:03:38.956: INFO/DEBUG(33):     480048bc  00000000  
05-31 10:03:38.956: INFO/DEBUG(33):     480048c0  fffffffa  
05-31 10:03:38.956: INFO/DEBUG(33):     480048c4  4001df77  /system/lib/libc.so
05-31 10:03:38.956: INFO/DEBUG(33):     480048c8  4086df90  /system/lib/libdvm.so
05-31 10:03:38.956: INFO/DEBUG(33):     480048cc  48004adb  
05-31 10:03:38.956: INFO/DEBUG(33):     480048d0  df0027ad  
05-31 10:03:38.956: INFO/DEBUG(33):     480048d4  00000000  
05-31 10:03:38.956: INFO/DEBUG(33): #00 480048d8  00000040  
05-31 10:03:38.965: INFO/DEBUG(33):     480048dc  6c756e28  
05-31 10:03:38.965: INFO/DEBUG(33):     480048e0  0000296c  
05-31 10:03:38.965: INFO/DEBUG(33):     480048e4  00000000  
05-31 10:03:38.965: INFO/DEBUG(33):     480048e8  00000000  
05-31 10:03:38.965: INFO/DEBUG(33):     480048ec  00000000  
05-31 10:03:38.965: INFO/DEBUG(33):     480048f0  00000000  
05-31 10:03:38.965: INFO/DEBUG(33):     480048f4  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     480048f8  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     480048fc  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004900  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004904  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004908  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     4800490c  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004910  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004914  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004918  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     4800491c  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004920  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004924  00000000  
05-31 10:03:38.975: INFO/DEBUG(33):     48004928  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     4800492c  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     48004930  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     48004934  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     48004938  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     4800493c  00000000  
05-31 10:03:38.985: INFO/DEBUG(33):     48004940  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004944  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004948  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     4800494c  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004950  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004954  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004958  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     4800495c  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004960  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004964  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     48004968  00000000  
05-31 10:03:38.995: INFO/DEBUG(33):     4800496c  00000000  
05-31 10:03:39.005: INFO/DEBUG(33):     48004970  00000000  
05-31 10:03:39.005: INFO/DEBUG(33):     48004974  00000000  
05-31 10:03:39.005: INFO/DEBUG(33):     48004978  00000000  
05-31 10:03:39.005: INFO/DEBUG(33):     4800497c  00000000  
05-31 10:03:39.005: INFO/DEBUG(33):     48004980  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     48004984  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     48004988  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     4800498c  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     48004990  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     48004994  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     48004998  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     4800499c  00000000  
05-31 10:03:39.015: INFO/DEBUG(33):     480049a0  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049a4  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049a8  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049ac  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049b0  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049b4  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049b8  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049bc  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049c0  00000000  
05-31 10:03:39.025: INFO/DEBUG(33):     480049c4  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049c8  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049cc  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049d0  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049d4  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049d8  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049dc  00000000  
05-31 10:03:39.035: INFO/DEBUG(33):     480049e0  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049e4  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049e8  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049ec  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049f0  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049f4  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049f8  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     480049fc  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     48004a00  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     48004a04  00000000  
05-31 10:03:39.045: INFO/DEBUG(33):     48004a08  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a0c  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a10  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a14  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a18  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a1c  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a20  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a24  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a28  00000000  
05-31 10:03:39.055: INFO/DEBUG(33):     48004a2c  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a30  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a34  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a38  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a3c  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a40  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a44  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a48  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a4c  00000000  
05-31 10:03:39.065: INFO/DEBUG(33):     48004a50  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a54  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a58  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a5c  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a60  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a64  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a68  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a6c  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a70  00000000  
05-31 10:03:39.075: INFO/DEBUG(33):     48004a74  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a78  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a7c  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a80  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a84  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a88  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a8c  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a90  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a94  00000000  
05-31 10:03:39.085: INFO/DEBUG(33):     48004a98  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004a9c  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004aa0  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004aa4  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004aa8  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004aac  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004ab0  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004ab4  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004ab8  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004abc  00000000  
05-31 10:03:39.095: INFO/DEBUG(33):     48004ac0  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ac4  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ac8  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004acc  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ad0  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ad4  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ad8  00000000  
05-31 10:03:39.105: INFO/DEBUG(33):     48004adc  ea30aae6  
05-31 10:03:39.105: INFO/DEBUG(33):     48004ae0  00000000  
05-31 10:03:39.115: INFO/DEBUG(33):     48004ae4  48004b24  
05-31 10:03:39.115: INFO/DEBUG(33):     48004ae8  00000000  
05-31 10:03:39.115: INFO/DEBUG(33):     48004aec  407ff8b3  /system/lib/libdvm.so
05-31 10:03:39.115: INFO/DEBUG(33): #01 48004af0  00000001  
05-31 10:03:39.115: INFO/DEBUG(33):     48004af4  40800703  /system/lib/libdvm.so
05-31 10:03:45.166: INFO/BootReceiver(76): Copying /data/tombstones/tombstone_09 to DropBox (SYSTEM_TOMBSTONE)
05-31 10:03:45.205: DEBUG/Zygote(36): Process 8963 terminated by signal (11)
05-31 10:03:45.215: WARN/InputDispatcher(76): channel '415bf478 im.myApp.Me/im.myApp.Me.home (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
05-31 10:03:45.215: ERROR/InputDispatcher(76): channel '415bf478 im.myApp.Me/im.myApp.Me.home (server)' ~ Channel is unrecoverably broken and will be disposed!
05-31 10:03:45.305: DEBUG/dalvikvm(76): GC_FOR_ALLOC freed 217K, 14% free 11493K/13319K, paused 126ms
05-31 10:03:45.315: INFO/WindowManager(76): WIN DEATH: Window{415bf478 im.myApp.Me/im.myApp.Me.home paused=false}
05-31 10:03:45.315: WARN/InputDispatcher(76): Attempted to unregister already unregistered input channel '415bf478 im.myApp.Me/im.myApp.Me.home (server)'
05-31 10:03:45.325: INFO/ActivityManager(76): Process im.myApp.Me (pid 8963) has died.
05-31 10:03:45.325: WARN/ActivityManager(76): Force removing ActivityRecord{4145a7a8 im.myApp.Me/.home}: app died, no saved state
05-31 10:03:45.336: WARN/NetworkManagementSocketTagger(76): setKernelCountSet(10040, 0) failed with errno -2
05-31 10:03:45.365: INFO/WindowManager(76): WINDOW DIED Window{415bf478 im.myApp.Me/im.myApp.Me.home paused=false}
05-31 10:03:45.385: WARN/NetworkManagementSocketTagger(76): setKernelCountSet(10034, 1) failed with errno -2
05-31 10:03:45.555: WARN/InputManagerService(76): Got RemoteException sending setActive(false) notification to pid 8963 uid 10040
05-31 10:03:45.925: DEBUG/dalvikvm(76): GC_CONCURRENT freed 368K, 12% free 11739K/13319K, paused 11ms+10ms

1 个答案:

答案 0 :(得分:2)

你应该这样做:

public void changeVisibility(){

             Thread _trd1 = new Thread() {
                    public void run() {
                        runOnUiThread(new Runnable() {
                        public void run() {
                            wv.setVisibility(View.GONE);
                        }
                });
                    }
              };

             _trd1.start();

         }