• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display photos in ListView

 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I want to show the photos i take in a listview. It's actually being pretty hard to make this, i've been trying to make this for the last week without success. On my last post here i asked how to put two collumns in the same listview so i though in trying to use that code to achieve this. My problem is that when i take the pohto and want to see, it doesnt give any error instead appears the layout without any photo. My main question is if i can use this and if so, what's missing.

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you have provided enough information to figure out where the problem is, it sounds like you aren't really sure yourself. Here are some questions though:
1) What is the purpose of the data object? It appears to be a List, but you clear it at the beginning of each do loop cycle and only ever access the value at index zero. It is a needless and confusing redirect for storing a single value. Why not just do nome = cursor.getString(cursor.getColumnIndex("cam"));?

2) What is the purpose of the Map you put into mylist? It only ever has one key/value pair, so why do you need it? Can't you just put the Bitmap into mylist and reduce yet more confusion caused by unneeded objects?

3) If you wanted multiple columns, is there a reason you didn't use a GridView? Works on exactly the same principle as ListView, but you can have multiple columns.

I think what you are going to have to do is add some break points in both your code which makes the List and the code which displays the ListView and run it in debug mode so you can see what values are available when the code is executed.
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying. I was a bit (or very) confused. The data was just gathering all the information but it was unnecessary. I also dropped the Map and put it into mylist.
I was also losing the value along the way. I re-made my code and it's working.

Thanks for the directions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic