title: findViewById in non-Activity class
body: <p>Still being relatively new to this I'm having issues in finding a view in a non-activity class MyLocation which I'm using in my activity class MainActivity. I'm using MyLocation to get longitude and latitude.
  I want to highlight a textview when either GPS or Network has been used. To do so I need to find the textviews in the non-activity class MyLocation.</p>
  
  <p>Here is how I'm calling it in MainActivity:</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity implements LocationListener {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
              MyLocation myLocation = new MyLocation();
              myLocation.getLocation(this, locationResult);
  
  }
  </code></pre>
  
  <p>And here what I tried in MyLocation to find the textviews:</p>
  
  <pre><code>public class MyLocation {
  
  LocationManager lm;
  LocationResult locationResult;
  private Context context;
  TextView tvnetwork, tvgps;
  private int defaultTextColor;
  
  LocationListener locationListenerNetwork = new LocationListener() {
      public void onLocationChanged(Location location) {
  
          locationResult.gotLocation(location);
  
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View v = inflater.inflate(R.layout.main, null);
  
          tvnetwork = (TextView) v.findViewById(R.id.tvnetwork);
          tvgps = (TextView) v.findViewById(R.id.tvgps);
          defaultTextColor = tvgps.getTextColors().getDefaultColor();
  
          tvnetwork.setTextColor(context.getResources().getColor(
                  R.color.green));
          tvgps.setTextColor(defaultTextColor);
  
          lm.removeUpdates(this);
          lm.removeUpdates(locationListenerGps);
      }
  
      public void onProviderDisabled(String provider) {
      }
  
      public void onProviderEnabled(String provider) {
      }
  
      public void onStatusChanged(String provider, int status, Bundle extras) {
      }
  };
  </code></pre>
  
  <p>But the views are not found. I already get a NPE @ <code>.getSystemService(Context.LAYOUT_INFLATER_SERVICE);</code>. What am I doing wrong?</p>