Hi, I am new to Android development. I have 20 years pro development experience with over 10 years C#. When I found out about Xamarin, I though that would be perfect for me to get into Phone app development. The basics are easy and I got a nice little app up and running in no time. I then thought it needed Tabs to partition the functions. I thought this would be simple.... WOW !!!! What was I wrong!. It's taken me hours of Googling and trying code and I still can't get it to work....
Basic code flow: I started with the LegacyBar sample. I have an Activity that creates 2 tabs. I want my main app functionality to run in the first tab.
The tab fragment opens with the code:
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = inflater.Inflate(Resource.Layout.PageAgeGrader, container, false);
.... blar blar....
// Get our objects from the layout resource,
Button btnCalculate = view.FindViewById<Button> (Resource.Id.btnCalculate);
btnCalculate.Visibility = ViewStates.Gone;
btnCalculate.Click += (object sender, EventArgs e) => {
btnCalculate_click (sender, e);
};
}
private void btnCalculate_click(object sender, EventArgs e)
{
********* The above line gives me a 'FindViewById' does not exist in this context here!*******
Spinner spnCategory = FindViewById<Spinner> (Resource.Id.spnCategory);
.... blar blar....
}
How do I reference a control from a delegate method like this ?
I am also getting a few other errors which I haven't started to look at yet. For example the following fails with "invalid args" but this works fine in the tabless version:
ArrayAdapter myAdaptor = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerItem, lstAge.Distinct().ToList());
Any help would be appreciated.
thanks Dave