0

Здравствуйте! Как в VKSdk andnroid выполнять запросы к методам account?

    final TextView requestText = (TextView) findViewById(R.id.state);
    final VKRequest request = VKApi.account().getProfileInfo(VKParameters.from(VKApiConst.FIELDS,"first_name,last_name"));
     request.executeWithListener(new VKRequest.VKRequestListener() {
         @Override
         public void onComplete(VKResponse response) {
             super.onComplete(response);

             VKList list = (VKList) response.parsedModel;
             if(list!=null) {
                 for (int i = 0; i < list.size(); i++) {
                     requestText.append("\n" + list.get(i).toString());
                 }
             }   
         }

         @Override
         public void onError(VKError error) {
             super.onError(error);
             requestText.setText(error.toString());
         }
     });

На строчку final VKRequest request = VKApi.account().getProfileInfo(VKParameters.from(VKApiConst.FIELDS,"first_name,last_name")); IDE ругается и подсвечивает красным account(). Оно и понятно в vk-android-sdk отсутствует класс для доступа к методам account.

1 ответ 1

0

Загрузка произвольного метода API:

VKRequest request = new VKRequest("account.getProfileInfo", VKParameters.from(VKApiConst.FIELDS,"first_name,last_name"));

Официальная документация, подпункт 5

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.