title: how to get contacts from google contacts programmatically in android
body: <p>i am using contacservice class and i set the usercredentials of my gmail account
  and i want to get the contact from the google contacts for that my code as follows</p>
  
  <pre><code>ContactService myservice=new ContactService("ex-app-1.0");
  
    myservice.setUserCredentials("username","password");
  
    URL url=new URL("https://www.google.com/m8/feeds/contacts/xxx@gmail.com/full");
  
  ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class);
  </code></pre>
  
  <p>but i got an exception like this in logcat</p>
  
  <pre><code>03-16 12:24:49.217: E/AndroidRuntime(1013): FATAL EXCEPTION: main
  
  03-16 12:24:49.217: E/AndroidRuntime(1013): java.lang.RuntimeException: Unable to start activity
  
  ComponentInfo{c.b.p/c.b.p.ContactsBackupActivity}: java.lang.NullPointerException
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.os.Handler.dispatchMessage(Handler.java:99)
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.os.Looper.loop(Looper.java:123)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at java.lang.reflect.Method.invoke(Method.java:521)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at dalvik.system.NativeStart.main(Native Method)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013): Caused by: java.lang.NullPointerException
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at c.b.p.ContactsBackupActivity.onCreate(ContactsBackupActivity.java:128)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  
  03-16 12:24:49.217: E/AndroidRuntime(1013):     ... 11 more
  03-16 12:29:49.329: I/Process(1013): Sending signal. PID: 1013 SIG: 9
  </code></pre>