0

I want to load image in card view with other data like title and desc.

I am uaing php to get result as json response which is working and also i am able to set data to textview and pass from one activity to other !

Only problem i am facing is in setting image in image view.

i can add image manually by making listview obj and storing link in ArrayList obj

Like obj.add(R.drawable.feature1.jpg)

How to do it dynamically from the json response i am getting ?

Sorry if i sound confusing as i am new to android and just want to make a image gallery where first i will display list of albums and after clicking one of albums all images from that albums are loaded and displayed.

{"products":[{"mid":"1","title":"Demo Video 1","link":"https:\/\/m.youtube.com\/watch?v=PCwjNfSM-U","mediaCreatedOn":"2015-08-30 18:59:18","mediaUpdatedOn":"0000-00-00 00:00:00"},{"mid":"2","title":"Demo Video 1","link":"https:\/\/www.youtube.com\/","mediaCreatedOn":"2015-08-30 18:59:18","mediaUpdatedOn":"0000-00-00 00:00:00"}],"success":1}

The above is the output from server side where only the youtube link is replaced by server img location.

Thank you for reading, have a nice day ahead :)

1 Answers1

0

1:You can store image to database Example:mysite.com/img/34324234342.png (phpMysql)

2:And you can get image from php rest service (Only image link)

3:For load image from link , you can use picasso library (android)

4:If you want image with text, you can use custom listview

Example xml for restful service.

<myimage>
    <title>abc</title>
    <ipath>mysite.com/img/34324234342.png</ipath>
</myimage>
manowar_manowar
  • 1,215
  • 2
  • 16
  • 32
  • How can i do it with card view ? I am not introduced to rest feature of php ... an example code would be much helpful. – user5320649 Sep 10 '15 at 09:59
  • Maybe this links help you. http://stackoverflow.com/questions/26552372/appcompat-cardview-and-picasso-no-rounded-corners http://stackoverflow.com/questions/28316810/generate-cards-with-cardslib-and-load-images-with-picasso – manowar_manowar Sep 10 '15 at 10:05