title: Vk sdk for android
body: <p>I want to make autorizathion with vk.com. I download <a href="https://github.com/VKCOM/vk-android-sdk" rel="nofollow">this</a> library, but there is no normal exemple how to use it? I try next code, but it is not work for me.</p>
  
  <pre><code> package ua.khuta.testVkSdk;
  
     import android.app.Activity;
      import android.app.AlertDialog;
     import android.content.Intent;
     import android.os.Bundle;
     import com.vk.sdk.*;
     import com.vk.sdk.api.VKError;
  
  public class MyActivity extends Activity {
      /**
       * Called when the activity is first created.
       */
  
  
          private static String sTokenKey = "VK_ACCESS_TOKEN";
          private static String[] sMyScope = new String[]{VKScope.FRIENDS, VKScope.WALL, VKScope.PHOTOS, VKScope.NOHTTPS};
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              VKSdk.initialize(sdkListener, "id_приложения", VKAccessToken.tokenFromSharedPreferences(this, sTokenKey));
              setContentView(R.layout.main);
              VKSdk.authorize(sMyScope, true, false);
          }
  
          @Override
          protected void onResume() {
              super.onResume();
              VKUIHelper.onResume(this);
          }
  
          @Override
          protected void onDestroy() {
              super.onDestroy();
              VKUIHelper.onDestroy(this);
          }
  
          @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
              VKUIHelper.onActivityResult(requestCode, resultCode, data);
          }
  
          private VKSdkListener sdkListener = new VKSdkListener() {
              @Override
              public void onCaptchaError(VKError captchaError) {
                  new VKCaptchaDialog(captchaError).show();
              }
  
              @Override
              public void onTokenExpired(VKAccessToken expiredToken) {
                  VKSdk.authorize(sMyScope);
              }
  
              @Override
              public void onAccessDenied(VKError authorizationError) {
                  new AlertDialog.Builder(MyActivity.this)
                          .setMessage(authorizationError.errorMessage)
                          .show();
              }
  
              @Override
              public void onReceiveNewToken(VKAccessToken newToken) {
                  newToken.saveTokenToSharedPreferences(MyActivity.this, sTokenKey);
                 // Intent i = new Intent(LoginActivity.this, MainActivity.class);
                 // startActivity(i);
              }
  
              @Override
              public void onAcceptUserToken(VKAccessToken token) {
                  //Intent i = new Intent(LoginActivity.this, MainActivity.class);
                 // startActivity(i);
              }
          };
  
       }
  </code></pre>
  
  <p>Text of error</p>
  
  <pre><code> 03-27 16:42:16.189: WARN/System.err(19974): java.net.BindException: Context must not be null
  03-27 16:42:16.189: WARN/System.err(19974): at com.vk.sdk.VKSdk.checkConditions(VKSdk.java:90)
  03-27 16:42:16.189: WARN/System.err(19974): at com.vk.sdk.VKSdk.authorize(VKSdk.java:170)
  03-27 16:42:16.189: WARN/System.err(19974): at ua.khuta.testVkSdk.MyActivity.onCreate(MyActivity.java:23)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.Activity.performCreate(Activity.java:5231)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.ActivityThread.access$800(ActivityThread.java:135)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  03-27 16:42:16.189: WARN/System.err(19974): at android.os.Handler.dispatchMessage(Handler.java:102)
  03-27 16:42:16.189: WARN/System.err(19974): at android.os.Looper.loop(Looper.java:136)
  03-27 16:42:16.189: WARN/System.err(19974): at android.app.ActivityThread.main(ActivityThread.java:5017)
  03-27 16:42:16.189: WARN/System.err(19974): at java.lang.reflect.Method.invokeNative(Native Method)
  03-27 16:42:16.189: WARN/System.err(19974): at java.lang.reflect.Method.invoke(Method.java:515)
  03-27 16:42:16.189: WARN/System.err(19974): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  03-27 16:42:16.189: WARN/System.err(19974): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  03-27 16:42:16.189: WARN/System.err(19974): at dalvik.system.NativeStart.main(Native Method)
  03-27 16:42:16.189: INFO/ActivityManager(593): Resuming delayed broadcast
  </code></pre>