H
H
Horoko2015-02-28 22:11:21
Android
Horoko, 2015-02-28 22:11:21

Where to store and how to process Response VK SDK Android?

Subject. Here is a sample code. VKApiAudio, as I understand it, stores only one audio record received from Response. Then how to get them in large quantities? Is there a class in which they can be stored, such as VKApiCommunityArray? And how to work with them, for example, select only the Title and Artist?

public void onMyButtonClick(View view) {
        VKParameters params = new VKParameters();
        params.put(VKApiConst.OWNER_ID, "1");
        params.put(VKApiConst.COUNT, "3");
        VKRequest requestaudio = new VKRequest("audio.get", VKParameters.from(VKApiConst.OWNER_ID, "1", VKApiConst.COUNT, "3"));
        requestaudio.executeWithListener(new VKRequest.VKRequestListener() {

            @Override
            public void onComplete(VKResponse response) {
                super.onComplete(response);

                VKApiAudio audio = (VKApiAudio) response.parsedModel;

                if (audio == null) {
                    Log.v("Ошибка", "Ничего не загрузилось");
                } else {
                    Log.v("User name:", audio.artist + audio.title);
                }
            }
            @Override
            public void onError(VKError error) {
                super.onError(error);
                Log.v("l");
            }
        });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question