Answer the question
In order to leave comments, you need to log in
Is the adapter created correctly?
public class CustomAdapter extends BaseAdapter {
private Context context;
private String[] stringValues;
LayoutInflater lInflater;
public CustomAdapter(Context context, String[] stringValues)
{
this.context = context;
this.stringValues = stringValues;
lInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = convertView;
if (view == null) {
view = lInflater.inflate(R.layout.item, parent, false);
}
TextView textView = (TextView) view.findViewById(R.id.colors);
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.llColors);
textView.setText(stringValues[position]);
return view;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question