Search Results

Search found 2 results on 1 pages for 'drbob'.

Page 1/1 | 1 

  • Android Bind Spinner to Class

    - by drbob
    I'm having some trouble with the Spinner widget. Given the following code: ArrayList<Person> people= new ArrayList<Person>(); Person = null; for(int i = 0; i!= 10; i++) { p = new Person(); s.setID(i); s.setName("Name " + i); people.add(s); } I'm using the following code to bind it to a Spinner: Spinner spinner1 = (Spinner) findViewById (R.id.spinner); ArrayAdapter<Person> adapter = new ArrayAdapter<Person>(this, android.R.layout.simple_spinner_item, people); spinner1.setAdapter(adapter); What I would like is for the value (id) to be hidden but passed when selected, and the name to appear. Any help is appreciated. Thanks.

    Read the article

  • c# Convert LINQ var result to actual type

    - by DrBob
    In c#, Given the following code: public class Person { public int PersonID { get; set; } public int Age { get; set; } public string Name { get; set; } } and List<Person> people = new List<Person>(); for (int i = 0; i != 15; i++) { Person p = new Person(); p.PersonID = i; p.Age = i * 12; p.Name = "Name " + i; people.Add(p); } var sortedPeople = from qPeople in people where qPeople.Age > 0 && qPeople.Age < 25 || qPeople.Age > 100 orderby qPeople.Age descending select qPeople; Can I load the results of sortedPeople back into a List<Person without a loop? Thanks.

    Read the article

1