android - Layoutinflater in arrayadapter -


why code doesn't work in arrayadapter?.

    layoutinflater inflater=getlayoutinflater();  

while code work. difference, can explain in simple language beginner.

layoutinflater inflater=(layoutinflater)context.getsystemservice(context.layout_inflater_service); 

your arrayadapter class out of application context, need application context instance within arrayadapter class can layoutinflater instance.

you cannot inflate views out of application context , layoutinflater does.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -