2016-05-15 2 views
0

こんにちは、私はAndroid用のXamarin C#を使用しています。 ListViewでウィジェットを作成しようとしました。Xamarin Androidサービスにバインドできませんヌルポインタ

私の移植コード:https://github.com/Nailik/AppWidgetListView

まず私は、C#にこれを移植: https://laaptu.wordpress.com/2013/07/19/android-app-widget-with-listview/ (ソース:https://github.com/laaptu/appwidget-listview/tree/appwidget-listview1

をそれから私は、この変更をした:https://forums.xamarin.com/discussion/16930/app-widget-with-listview

、今私は立ち往生。私はそれだけでremoteviewsに空のビューを示していますし、このエラーでクラッシュしている私の画面にウィジェットを追加しようと毎回:

Java.Lang.RuntimeException: Unable to bind to service [email protected] with Intent { dat=intent: cmp=StimeApplication.StimeApplication/md5037fca43706e0b812912372d4076c895.WidgetService (has extras) }: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference ---> Java.Lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference 
    at --- End of managed exception stack trace --- 
    at java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference 
    at at android.widget.RemoteViewsService.onBind(RemoteViewsService.java:243) 
    at at android.app.ActivityThread.handleBindService(ActivityThread.java:2939) 
    at at android.app.ActivityThread.access$1900(ActivityThread.java:169) 
    at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1511) 
    at at android.os.Handler.dispatchMessage(Handler.java:111) 
    at at android.os.Looper.loop(Looper.java:194) 
    at at android.app.ActivityThread.main(ActivityThread.java:5552) 
    at at java.lang.reflect.Method.invoke(Native Method) 
    at at java.lang.reflect.Method.invoke(Method.java:372) 
    at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) 
    at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759) 
    --- End of inner exception stack trace --- 
    at --- End of managed exception stack trace --- 
    at java.lang.RuntimeException: Unable to bind to service [email protected] with Intent { dat=intent: cmp=StimeApplication.StimeApplication/md5037fca43706e0b812912372d4076c895.WidgetService (has extras) }: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference 
    at at android.app.ActivityThread.handleBindService(ActivityThread.java:2952) 
    at at android.app.ActivityThread.access$1900(ActivityThread.java:169) 
    at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1511) 
    at at android.os.Handler.dispatchMessage(Handler.java:111) 
    at at android.os.Looper.loop(Looper.java:194) 
    at at android.app.ActivityThread.main(ActivityThread.java:5552) 
    at at java.lang.reflect.Method.invoke(Native Method) 
    at at java.lang.reflect.Method.invoke(Method.java:372) 
    at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) 
    at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759) 
    at Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void android.widget.RemoteViewsService$RemoteViewsFactory.onCreate()' on a null object reference 
    at at android.widget.RemoteViewsService.onBind(RemoteViewsService.java:243) 
    at at android.app.ActivityThread.handleBindService(ActivityThread.java:2939) 
    at ... 9 more 

私が誰かが私を助けることができると思いますが、私は何を検索する見当がつかないと、このエラーは出番から。

答えて

5

検索の数時間後に修正されました。回答: "Java.Lang.Objectから継承し、HandleメソッドとDisposeメソッドを削除する必要があります。" 投稿者https://forums.xamarin.com/discussion/8506/crash-from-native-handle 私もgit resporityを更新していますので、これを自由に使用してください。

関連する問題