1

I'm using Picasso to get images from a website. (TheMovieDB)

System.out.println("http://image.tmdb.org/t/p/w185" + 
        String.valueOf(posters.get(position).values())

I'm just using the code above to test a listView.setOnItemClickListener

Posters:

static ArrayList<HashMap<String, String>> posters;

The problem is when i click an item in the listview (all the items have the same link for now) it returns this:

I/System.out: http://image.tmdb.org/t/p/w185[/kqjL17yufvn9OVLyXYpvtyrFfak.jpg]

How do i get it to return the posters.get(position).values() as a string? So that it can properly concatenate the String.

I am doing that to get the movie poster links from the API and display in the listview.

if (getActivity() != null) {
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                System.out.println("http://image.tmdb.org/t/p/w185" +
                        String.valueOf(posters.get(position).values()));
            }
        });
    }
2
  • post your listView.setOnItemClickListener code Commented May 5, 2017 at 10:28
  • can you please post the code of posters arraylist? Commented May 5, 2017 at 14:15

1 Answer 1

1

Try this :

System.out.println("http://image.tmdb.org/t/p/w185" + 
    String.valueOf(posters.get(position).get("yourKey"))
Sign up to request clarification or add additional context in comments.

4 Comments

my key is generated by an array, i take a list of ids from the api, put the id as first string and img url as second img
then pass id in place of yourKey
I'll try that as soon as i get to my laptop. Thank you for the help. I've looked for so long at the code that i didn't even realise that
Somewhat. I used .replace() to get rid of the [ ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.