java.lang.reflect.InvocationTargetException in xamarin.android -
i exception when click button in fragment.
below code fragment
public override java.lang.object instantiateitem(viewgroup container, int position) { int pos = position + 1; if (pos == 1) { view view = layoutinflater.from (container.context).inflate (resource.layout.pager_item, container, false); container.addview (view); return view; } else if (pos == 2) { view view = layoutinflater.from (container.context).inflate (resource.layout.bookaservice, container, false); spinner spinner = view.findviewbyid<spinner> (resource.id.spinner); var adapter = arrayadapter.createfromresource ( container.context, resource.array.planets_array, android.resource.layout.simpledropdownitem1line); adapter.setdropdownviewresource (android.resource.layout.simpledropdownitem1line); spinner.adapter = adapter; var sel = spinner.selecteditem.tostring(); button = view.findviewbyid<button>(resource.id.buttonservice); try{ but.click += async (object sender, eventargs e) => { parseobject service = new parseobject("services ordered"); service["userid"] = parseuser.currentuser.objectid; service["name"] = sel; service["username"] = parseuser.currentuser.get<string>("name"); await service.saveasync(); toast.maketext(container.context,"your service request taken , our processed within 1 hour", toastlength.long).show(); }; }catch (exception e){ toast.maketext (container.context, e.tostring (), toastlength.long).show (); } container.addview (view); return view; } else { view view = layoutinflater.from (container.context).inflate (resource.layout.login, container, false); container.addview (view); return view; } }
when click button in fragment code throws exception as
java.lang.reflect.invocationtargetexception
i tried catch exception , toast screen didn't help.
please help.thanks.
the problem due space in declaring parse object.
parseobject service = new parseobject("services ordered");
Comments
Post a Comment