I am trying to make a custom style for android spinner, however there are several problems. I have noticed in many examples, they pass array to getCustomView method. I am wondering whether I can pass a list instead of an array.
Second problem is why they have declared variable and initialized in class variable scope? They have declared arrays like this.
String []data1={"Brainbitz:java","Brainbitz:Android","Brainbitz:Embedded Systems","Brainbitz:PHP"};
in class variable scope. But when I try to do for the list I get an error. why?
Third is,
If we can pass list to getCustomView how do I do that? Here is the link to the tutorial tutorial
I am considering this source code.
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row=inflater.inflate(R.layout.spinner, parent, false);
TextView label=(TextView)row.findViewById(R.id.textView1);
label.setText(list3.get(position));
// TextView sub=(TextView)row.findViewById(R.id.textView2);
// sub.setText(data2[position]);
//
// ImageView icon=(ImageView)row.findViewById(R.id.imageView1);
// icon.setImageResource(images[position]);
return row;
}
In above code I don't know the syntax to pass position to list3 list type reference.
Please be kind enough to explain this.