Behold:
public class MyActivity extends Activity {
// LayoutInflater inflater = (LayoutInflater) context
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // NOT CORRECT
LayoutInflater inflater; // correct
@Override
protected void onCreate(Bundle saved) {
super.onCreate(saved);
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // correct
}
}