Android

Themes not applying to ListView items Android

I applied themes for an app, Its worked fine for all screens except few screen which are having ListView custom items. Here is the cropped image of a ListView item row showing theme not apply to it

ListView

Solution:

Here is the solution for it, I implemented a custom ArrayAdapter class and i call that class like this

CustomListAdapter adapter = new CustomListAdapter(getApplicationContext(), R.layout.listitem);

after so much search, I find the issue is with above line at

getApplicationContext()

. See this link to know few more details.

So, I changed it to like this

CustomListAdapter adapter = new CustomListAdapter(ActivityName.this, R.layout.listitem);

Fixes the issue.. after that theme working fine with ListView item. and It shows like this below

list_item2

Hope It helps somebody out there 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *