I am working through John Horton\'s Android Programming for Beginners, and am currently attempting to create a note-taking app. Horton has just introduced ListVie
The best way to get a LayoutInflater
is by calling getLayoutInflater()
on an Activity
. That way, the activity's theme is taken into account. If NoteAdapter
is defined inside of an Activity
, just call getLayoutInflater()
. If NoteAdapter
is defined in its own separate Java class file, pass in a LayoutInflater
via the constructor.
To more directly address your question, any View
, like ListView
, can call getContext()
to get a Context
. That is where getSystemService()
is defined. So, replacing getSystemService()
with viewGroup.getContext().getSystemService()
would work.