Cannot declare ViewHolder as static inner class

android

Solution

If `IconicAdapter` is an inner class, you won't be able to declare an inner static class within it unless `IconicAdapter` is declared as a static class.

Problem

In my application, I am using a listview and have customized the associated array adapter by extending the standard the array adapter.However,inside the extended adapter, I am unable to declare the viewholder as a static inner class. Eclipse keeps giving the error that "static types can only be declared in static or top level types". Here is the code: ``` public class IconicAdapter extends ArrayAdapter<String> { public static class ViewHolder { public TextView text; public ImageView image; } public IconicAdapter() { super(MainActivity.this,R.layout.row,values); // TODO Auto-generated constructor stub } public View getView(int position,View convertView, ViewGroup parent) { View row = convertView; if(row == null) { LayoutInflater inflater = getLayoutInflater(); row = inflater.inflate(R.layout.row, parent,false); } TextView label =(TextView)row.findViewById(R.id.label); label.setText(values[position]); ImageView icon = (ImageView)row.findViewById(R.id.icon); icon.setImageResource(R.drawable.ok); return (row); } } ``` Any suggestion?

Original source