xamarin.android - NullReferenceException when calling ShowDialog on Android 2 -


i nullreferenceexception when calling acitiviy.showdialog(int) in response user tapping button. exception occurs in android 2.1 not in android 4.2. here stacktrace:

unhandled exception: system.nullreferenceexception: object reference not set instance of object @ (wrapper delegate-invoke) <module>.invoke_void__this___intptr_intptr_intptr_jvalue[] (intptr,intptr,intptr,android.runtime.jvalue[]) <0x000b3> @ android.runtime.jnienv.callvoidmethod (intptr,intptr,android.runtime.jvalue[]) <0x00053> @ android.app.activity.showdialog (int) <0x0011f> @ myapp.androidapp.invoiceactivity.showscheduledatedialog (object,system.eventargs) <0x0003b> @ android.views.view/ionclicklistenerimplementor.onclick (android.views.view) <0x00057> @ android.views.view/ionclicklistenerinvoker.n_onclick_landroid_view_view_ (intptr,intptr,intptr) <0x00063> @ (wrapper dynamic-method) object.be0dcca3-9ca4-47b4-a6a4-f691d34675f1 (intptr,intptr,intptr) <0x00043> 

any ideas?

i found weird workaround. noticed if app opens alertdialog @ point before trying show datepickerdialog, works. doing this:

var helperdialog = new alertdialog.builder(this).settitle("").show(); helperdialog.hide(); 

right before returning datepickerdialog in oncreatedialog seems fix problem. it's ugly workaround, doesn't seem have side effects final user.

no idea if android bug or monodroid bug.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -