android - Implementing Custom adapter -


Text after "

I am creating a custom adapter, simple stuff and it has exploded on the public integer getCount () of adpater. I do not know what I'm remembering?

  The public class extends GREVocabulary activity {/ ** is called when the activity has been created first. * / @Override Public Zero onCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); // set color mlayout.setBackgroundColor (Color.WHATEVER); SetContentView (R.layout.main); & Lt; String & gt; Alphabetslsit = arrays.asList (getResources (). GetStringArray (R. W. Alphabet)); Spinner Spinner = (Spinner) Find VVBIID (RID Spinner); {Try AlphabetAdapter Adapter = New Alphabet Adapter (This, AlphabetSit); Spinner.setAdapter (adapter); } Hold (exception e) {Log.v (e.toString (), e.getMessage ()); }}} Public Class Alphabet Adapter Extends BidAPP Extender SpinnerAdvertiser {Private List & lt; String & gt; Aplhabetlist; Personal reference references; Public Alphabet Adapter (reference reference, list & lt; string & gt; aplhabetlist) {this.context = context; This.aplhabetlist = aplhabetlist; } @ Override Public In Receipt () {return aplhabetlist.size (); } @OverWide Public Object Hostname (Int Aug 0) {return aplhabetlist.get (arg0); } @ Override Public Long ITEMID (Int. Az 0) {Return RGR; } @ Override Public View getView (int arg0, see arg1, ViewGroup arg2) {View View = Super .getDropDownView (arg0, arg1, arg2); // if (arg0% 2 == 0) // {// view.setBackgroundColor (Color.BLUE); //} return view; }}   

exeception i

  // getting stacked the following: 2, of the locals: 2 public bridge synthetic zero setAdapter (android.widget. Adapter x0); 0 aload_0 [this] 1 aload_1 [x0] 2 checkcast android.widget.SpinnerAdapter [7] 5 invokevirtual android.widget.AbsSpinner.setAdapter (android.widget.SpinnerAdapter): Zero [8] 8 Return Line Number: [PC: 0 Local PC: 0, PC: 9] Local: x0 Index: 1 Type: Android: [PC: 0, PC: 9] Local: This Index: 0 Type: android.widget.AbsSpinner [PC: 0, PC: 9] Local: Widget.Adapter // Method descriptor # 67 () Landroid / Widget / Adapter; // Stack: 1, Local: 1 public bridge synthetic android.widget.Adapter getAdapter (); [Pc: 0, line: 2] Local variable table: [PC: 0, pc: 0] [0] [alias] [this] 1 android.widget.AbsSpinner.getAdapter () invokevirtual: android.widget.SpinnerAdapter [9] 5] Local: This index: 0 type: android.widget.AbsSpinner inner class: [Internal classroom information: # 36 Android / view / view group $ layout, external category information: # 83 Android / view / view inside customer name : # 37 layout params, accessflags: 9 public static]    

BaseAdapter already spin NerAdapter applies. Therefore, there is no need to apply spinner adapter explicitly.

HH!

Comments