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
mahesh.sidhu58@gmail.commahesh.sidhu58@gmail.com 

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....

 

http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android

 

Code is 

 

String objectType = "Account";

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


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

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 ...

Thanks

Mahesh

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,

Kevin