I have a custom ArrayAdapter
set to a listView
. Inside each element of the listView
I have an item that matches a .xml I created. Codes shown below:
listContent.xml
<RelativeLayout
[... some code ommited]
<ImageView
[...]
<TextView
android:id="@+id/listViewText"
[...]
Custom Array Adapter getView(int position, View convertView, ViewGroup parent)
if (position < 4)
{
convertView = inflater.inflate(R.layout.listContent,null);
TextView tv = (TextView) findViewById(R.id.listViewText);
tv.setTextSize(18);
if (position == 0) tv.setText("0");
else if (position == 1) tv.setText("1");
else if (position == 2) tv.setText("2");
else if (position == 3) tv.setText("3");
return convertView;
}
return null;
I can't seem to get this to work, I always get some error. What do I need to do in order to edit the TextView
inside my listView item?