android - Facebook sharing from my app crashes on Motorola Droid? -


i have developed app allows post data on facebook wall using facebook sdk.i have tested on few other phones lg optimus when app runs on motorola droid crashes @ times.

when click on share facebook button in context menu app crashes.

i have googled , found out

http://groups.google.com/group/android-developers/browse_thread/thread/92d6f063682d2ca4/735acce1300115d7?show_docid=735acce1300115d7&pli=1.

there problem droid phones when using web kit.

the same issue reported on facebook sdk https://github.com/facebook/facebook-android-sdk/issues/82?authenticity_token=a321076df454835ad9c481d6fa73a3ea8cad1ceb

again said exception has occurred during use of motorola droid.

here stack trace:

java.lang.nullpointerexception     @ android.webkit.webview.onwindowfocuschanged(webview.java:4177)     @ android.view.view.dispatchwindowfocuschanged(view.java:3788)     @ android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:658)     @ android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:662)     @ android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:662)     @ android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:662)     @ android.view.viewroot.handlemessage(viewroot.java:1921)     @ android.os.handler.dispatchmessage(handler.java:99)     @ android.os.looper.loop(looper.java:123)     @ android.app.activitythread.main(activitythread.java:4627)     @ java.lang.reflect.method.invokenative(native method)     @ java.lang.reflect.method.invoke(method.java:521)     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:858)     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)     @ dalvik.system.nativestart.main(native method) 

does have solution or workaround this?

edit:this seems happening on htc incredible also.

there work around explicitly mentions motorola droid can find original posting at:

workaround null pointer excpetion in webview.onwindowfocuschanged

create custom webclass:

customwebview.java

public class customwebview extends webview {      public customwebview(context context) {         super(context);     }      public customwebview(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);     }      public customwebview(context context, attributeset attrs) {         super(context, attrs);     }      @override     public void onwindowfocuschanged(boolean haswindowfocus) {         try{             super.onwindowfocuschanged(haswindowfocus);         }catch(nullpointerexception e){         // catch null pointer exception         }     } } 

now open fbdialog.java provided facebook , modify line creates webview use the customwebview subclass follows

webview view = new customwebview(getcontext());


Comments