Xamarin : Using ArrayAdapter in an Android Fragment -
i trying use arrayadapter populate spinner view located in fragment follows
public override view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { var view = inflater.inflate(resource.layout.salarydefinition, container, false); spnbanks = view.findviewbyid<spinner>(resource.id.spinner1); spnbanks.adapter = new arrayadapter<string>(context, resource.layout.salarydefinition, sections); return view; }
the problem can't find context pass arrayadapter constructor.
any idea how solve this, or populate spinner view in fragment?
fragment
has getactivity
method, returns activity fragment associated with. use in place of context
.
Comments
Post a Comment