Android.Views.View - Namespace not found

I've created a project of type "Blank App (Android)". When creating an array adapter class I'm getting the error "The type or namespace name 'Views' does not exist in the namespace...". My project has a reference to Mono.Android, v2.0.50727, and Mono.Data.Sqlite, 2.0.5.0. In the project properties the compile version is set to API Level 8 (Xamarin.Android. v2.2 Support), and both the Minimum and Target Android versions are set to "Use compile using SDK version".

All of these settings are identical to the GitHub notepad sample found at https://github.com/xamarin/monodroid-samples/tree/master/NotePad-Mono.Data.Sqlite, which builds and runs correctly on my PC.

I can't see what else I'm missing. Any thoughts?

`using System;
using Android.App;
using Android.Content;
using Android.Widget;

namespace ScreenTimeTrader.Android
{
class UserAdapter : ArrayAdapter
{
private Activity activity;

    public UserAdapter (Activity activity, Context context, int textViewResourceId, object[] objects)
        : base (context, textViewResourceId, objects)
    {
        this.activity = activity;
    }

    // namespace error appears below on "Views"
    public override   Android.Views.View GetView (int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
    {
        //Get our object for this position
        var item = (Note)this.GetItem (position);

        // Try to reuse convertView if it's not null, otherwise inflate it from our item layout
        // This gives us some performance gains by not always inflating a new view
        var view = (convertView ?? activity.LayoutInflater.Inflate (Resource.Layout.Manage, parent, false)) as LinearLayout;

        view.FindViewById<TextView> (Resource.Id.UserName).Text = Left (item.Body.Replace ("\n", " "), 25);
        view.FindViewById<TextView> (Resource.Id.TimeBank).Text = item.ModifiedTime.ToString ();

        return view;
    }`

Posts

Sign In or Register to comment.