Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:20:39+00:00 2026-06-13T19:20:39+00:00

I am playing around with Monodroid, trying to set an adaptor to a listview

  • 0

I am playing around with Monodroid, trying to set an adaptor to a listview at start up. I have a bunch of controls on the screen, what I am trying to do is when the button is clicked an item goes into the listview.

I don’t get any error from the debugger, just a “Unfortunately Application1 has stopped”, which makes it hard to work out what I am doing wrong.

Here is my code:

public class Activity1 : Activity
{
    List<string> items = new List<string>();
    ArrayAdapter<string> adaptor;
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.Main);
        int i = 0;

        items.Add("Hello world");
        adaptor = new ArrayAdapter<string>(this,
            Resource.Id.listView1,
            items);

        Button button = FindViewById<Button>(Resource.Id.button1);
        ListView listView = FindViewById<ListView>(Resource.Id.listView1);
        listView.SetAdapter(adaptor);

        button.Click += delegate
        {
            items.Add("Hello " + ++i);
            adaptor.NotifyDataSetChanged();
        };
    }
}

Upon a comment I found the Device Log with the following:

android.content.res.Resources$NotFoundException: Resource ID #0x7f050003 type #0x12 is not valid

This is the ID for the listview in Resource.Designer.cs

public const int listView1 = 2131034115;

The listview is declared like this:

    <ListView
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="wrap_content"
        p1:layout_height="fill_parent"
        p1:id="@+id/listView1"
        p1:layout_marginBottom="70dp" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:20:41+00:00Added an answer on June 13, 2026 at 7:20 pm

    I figured it out after reading through the documentation. When instantiating the ArrayAdapter it must be instantiated with reference to Android.Resource.Layout.SimpleListItem1 or another list item resource, rather than the listview itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While playing around with the emulator, I noticed that when trying to view a
Im playing around with the Tablesorter plug-in for jQuery and was trying to get
I am playing around with Mono Droid and trying to implement the following layout
playing around with a new samsung tablet i noticed they have mini apps on
Just playing around with java trying to learn it etc. Here is my code
I have been playing around with various methods of making the Visitor pattern in
Playing around with Google Maps these days, with some directions. I have a map
Just playing around with interfaces and I have a question about something which I
Been playing around with JavaScript, and what Im trying to do is only allow
Been playing around with Highcharts.js and am trying to get a percent stacked chart

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.