Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource.Id not working in Xamarin

This is main.axml file.

`<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:minWidth="25px"
    android:minHeight="25px">
    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/myListView" />
</LinearLayout>`

And this is the MainActivity.cs file :

protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle);

    // Set our view from the "main" layout resource
    SetContentView(Resource.Layout.Main);

    Glop = new List<string>();

    Glop.Add("Tom");
    Glop.Add("Dick");
    Glop.Add("Harry");

    Name = FindViewById<ListView>(Resource.Id.myListView);

}

I am trying to create a Listview in Xamarin Android.

I have changed the android Id to myListView and also have tried to rebuild the app but it still shows as an error . What should I do now ?

like image 262
ANSHIT KALAR Avatar asked Mar 30 '16 08:03

ANSHIT KALAR


1 Answers

Try rebuilding the app again and saving the main.axml file .

  • Build > Clean Solution

  • Build Solution

like image 117
Seinfeld Avatar answered Sep 18 '22 17:09

Seinfeld