title: Salesforce Rest API with android - NullPointerException @ AsyncRequestCallback
body: <p>I'm trying to get the Salesforce REST API working with Android and new to android programming, followed the sample code to connect with SFDC <a href="http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android#Authentication" rel="nofollow">http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android#Authentication</a> </p>
  
  <p>I'm trying to get a few records from SFDC and display them in the android app, looks like when the Async Call is made at "client.sendAsync(sfRequest, new AsyncRequestCallback()" - NullPointerException is thrown.</p>
  
  <p>I did see a couple of similar issues online, but didn't help me. Hoping if some one would point me in the right direction to troubleshoot this. Thanks much.</p>
  
  <pre><code>    public class GetAccountsActivity extends Activity {
  
      private PasscodeManager passcodeManager;
  
      private String soql;
      private String apiVersion;
      private RestClient client;
      private TextView resultText;
      private RestRequest sfRequest;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          // Get Api Version
          apiVersion = getString(R.string.api_version);
        //Create Query
          soql = "select id, name from Account limit 10";
  
        //  Setup view
          setContentView(R.layout.get_accounts_activity);
          ((TextView) findViewById(R.id.Acc_Title)).setText(apiVersion);
          // Passcode manager
  
          passcodeManager = ForceApp.APP.getPasscodeManager();
      }
  
      @Override 
      public void onResume() {
          super.onResume();   
  
      //Get SFClient
          // Login options
          String accountType = ForceApp.APP.getAccountType();
          LoginOptions loginOptions = new LoginOptions(
                  null, // login host is chosen by user through the server picker 
                  ForceApp.APP.getPasscodeHash(),
                  getString(R.string.oauth_callback_url),
                  getString(R.string.oauth_client_id),
                  new String[] {"api"});
  
          new ClientManager(this, accountType, loginOptions).getRestClient(this, new RestClientCallback() {
              @Override
              public void authenticatedRestClient(RestClient client) {
                  if (client == null) {
                      ForceApp.APP.logout(GetAccountsActivity.this);
                      return;
                  }
                  GetAccountsActivity.this.client = client;
              }
          });
            //Get Rest Object to query
              try {
                  sfRequest = RestRequest.getRequestForQuery(apiVersion, soql);
                  //Use SF Rest Client to send the request
                  client.sendAsync(sfRequest, new AsyncRequestCallback(){
                      @Override
                      public void onSuccess(RestRequest request, RestResponse response){
                      //Check responses and display results
                      // EventsObservable.get().notifyEvent(EventType.RenditionComplete);
                      }//end onSuccess
  
                      @Override
                      public void onError(Exception exception) {
                          //printException(exception);
                          EventsObservable.get().notifyEvent(EventType.RenditionComplete);                
                      }//End Exception for Async Method
                  });
              }catch (UnsupportedEncodingException e) {
                  //printHeader("Could Send Query request");
                  //printException(e);
                  return;
              }
      }
  }
  </code></pre>
  
  <p>enter code here</p>