title: How to access the instance of service object in onResume() part of an activity?
body: <p>There is a service and activity.</p>
  
  <p>Service class has one method </p>
  
  <pre><code>methodA().
  </code></pre>
  
  <p>Now I have binded the service in Activity and got the instance of service through service connection.</p>
  
  <p>problem is I can't access the instance of service inside onResume() method</p>
  
  <pre><code>Public void onResume(){
  forExample.  mService.methodA // is throwing null pointer exception
  }
  </code></pre>
  
  <p>update: 
     This is how I created a service instance</p>
  
  <pre><code>class A extends Activity{
  public ServiceClass mService = null; // service objecct
  void onCreate(){
         Intent ServiceIntent = new Intent(this,BleWrapper.class);    
         bindService(ServiceIntent,mServiceConnection,BIND_AUTO_CREATE);
         mLeService = BLEService.getInstance();
  } 
  Public void onResume(){
    mService.methodA // is throwing null pointer exception
  }
  }
  </code></pre>
  
  <p>my Service connection is </p>
  
  <pre><code>public final ServiceConnection mServiceConnection= new ServiceConnection() {  
      @Override
      public void onServiceConnected(ComponentName componentName, IBinder service) {
          mService = ((BleWrapper.LocalBinder) service).getService();
  )
  </code></pre>
  
  <p>Can any one please help me.</p>