Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't getPlaylist #170

Open
BRKNCD opened this issue Oct 14, 2018 · 0 comments
Open

Can't getPlaylist #170

BRKNCD opened this issue Oct 14, 2018 · 0 comments

Comments

@BRKNCD
Copy link

BRKNCD commented Oct 14, 2018

Hello, I'm a very noob user, and I'm trying to retrieve a vary specific Playlist from a very specific userId. It seems that I'm not able to do it, the only examples I found are old and don't help me. Here's what I tried:

https://stackoverflow.com/questions/35110025/accessing-list-of-playlists-from-pager-object

SpotifyApi api = new SpotifyApi();
    api.setAccessToken(token);
    SpotifyService spotify = api.getService();
    spotify.getPlaylists("USERID", new Callback<Pager<Playlist>>() {
        @Override
            public void success(Pager<Playlist> playlistPager, Response response) {
                Log.d("TEST", "Got the playlists");
            List<Playlist> playlists = playlistPager.items;
                    for (Playlist p : playlists) {
                        Log.e("TEST", p.name + " - " + p.id);
            }
        }
            @Override
            public void failure(RetrofitError error) {
                Log.e("TEST", "Could not get playlists");
        }
    });

If I copy-paste this, it underlines Callback<Pager> and gives me the error:
Class 'Anonymous Class derived from Callback' must either be declared abstract or implement abstract method 'onResponse(Call, Response) in 'Callback'

if I press alt+enter and add this method and onFailure and I adapt the succes() and failure() methods to those, it will be:

spotify.getPlaylists("USERID", new Callback<Pager<Playlist>>() {
            @Override
            public void onResponse(Call<Pager<Playlist>> playlistPager, Response<Pager<Playlist>> response) {
                Log.d("TEST", "Got the playlists");
                List<Playlist> playlists = playlistPager.items;
                for (Playlist p : playlists) {
                    Log.e("TEST", p.name + " - " + p.id);
                }
            }

            @Override
            public void onFailure(Call<Pager<Playlist>> call, Throwable t) {
                Log.e("TEST", "Could not get playlists");
            }
        });

But now, items is red coloured and it gives me this error: Cannot resolve symbol 'items'
and I can't find any solution to this :(

Thank you, and sorry if it's a silly question

@BRKNCD BRKNCD changed the title Can't getPlaylist Can't getPlaylist labels:help wanted Oct 14, 2018
@BRKNCD BRKNCD changed the title Can't getPlaylist labels:help wanted Can't getPlaylist labels:helpwanted Oct 14, 2018
@BRKNCD BRKNCD changed the title Can't getPlaylist labels:helpwanted Can't getPlaylist Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant