android - Spinner's ArrayAdapter of Integers works: with my simple Object it "hangs" -


if pass spinner simple array of integers works fine. want make exception of value 0 (zero).

        /*          * pass spinner adapter possible start numbers.          */         list<riderstatus> riderstatuses = datamodel.get().getriderstatuses();          list<integer> tempints = new arraylist<integer>(                 riderstatuses.size() + 1);           (int = 0; < riderstatuses.size(); i++) {             if (i == 0 || (riderstatuses.get(i).getstarted()                     && !riderstatuses.get(i).getfinished()))                 tempints.add(new integer(riderstatuses.get(i).getridernum()));         }          arrayadapter<integer> spinneradapter = new arrayadapter<integer>(                 mcallercontext, r.layout.big_spinner, tempints);          /*          * notify observers          */         spinneradapter.notifydatasetchanged();          viewholder.spinnerstartno = (spinner) convertview.findviewbyid(r.id.spinnerstartno);         viewholder.spinnerstartno.setadapter(spinneradapter); 

my object integer tostring returning text 0 case. replace integer riderno in code above. when click on spinner screen dims , buttons become unresponsive or slow respond.

this code object.

/**  * class riderno  * holds integer, implements tostring exception  * can made of rider 0 - "bandit" or unknown.  * use instead of integer in tempints.  did not work!  */ private class riderno  {     private integer mriderno;      riderno(int riderno) {         mriderno = riderno;     }      public string tostring() {         if( mriderno == 0 )             return "bandit";         else             return string.format("%d", mriderno);     }      public int getriderno() {         return mriderno;     }      public void setriderno(int riderno ) {         mriderno = riderno;     }  } 

full disclosure: surrounding code quite complicated. have list view driven queue (fifo). list view has 2 columns: captured time , spinner in question list (changing subset) of numbers.

i have more info:

this in log

01-25 13:59:50.958 32029-32029/ca.owensoundcyling.tttimer w/inputeventreceiver: attempted finish input event input event receiver has been disposed. 

and there question attempted finish input event input event receiver has been disposed

there 2 problems, @ least made 2 changes , got incrementally better. after fixing first, got real exception in code. problem - never got far.

  1. the riderno class needed public. i'm assuming android framework needed access outside of fragment?
  2. i had cast item @ spinner position object of class , use accessor integer. (pretty obvious.)

Comments