function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

Facing Null Pointer Exception in Android Rest API

Hello Guys,


I am trying to connect from Android to SFDC through Rest API. In the follwing link when I try to do CRUD operation it is showing Null Pointer Exception....


Code is 


String objectType = "Account";

fields.put("Name","Test Account");

RestRequest request = null;
try {
request = RestRequest.getRequestForCreate("22.0",
} catch (IOException e1) {
// TODO Auto-generated catch block

client.sendAsync(request, new AsyncRequestCallback() {

public void onSuccess(RestResponse response) {
try {


Catch(Exception e)





 Error is at the Red Line


Any Help is much appreciated ...



Kevin HawkinsKevin Hawkins

Looking at the code, I think your API version is incorrect in your call to RestRequest.getRequestForCreate().  The API version numbers are prefaced with a 'v', so your call should be:


request = RestRequest.getRequestForCreate("v22.0", objectType, fields);


Hope this helps,