I’m trying to use LayoutInflater in a loop, but each time one of these guys is instantiated, I need to modify at least 2 TextViews found within each instantiation. What i currently have at the moment instantates appropriately and adds the inflated xml view just like I want it to, but the result is that only the first instatiaton’s resources are getting modified, and therefore it just gets overwritten many times.
LayoutInflater inflater;
TextView eTitle;
for(String[] episode : episodes) {
//Log.d("Episodes", episode[0] + " / " + episode[2]);
inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.episode_list_item, listView);
eTitle = (TextView) findViewById(R.id.episode_list_item_title);
eTitle.setText(episode[2]);
}
Example output of my list:
- 04 – Episode 04
- Episode Title
- Episode Title
- Episode Title
where its supposed to look like this:
- 01 – Episode 01
- 02 – Episode 02
- 03 – Episode 03
- 04 – Episode 04
what do i need to do to ensure that im getting the corresponding unique textview id’s from my inflated layouts?
Why don’t you use ListView instead?