0

I am getting full image path (list in JSON format) from getphotos.php. Now I want to show it in Android using Picasso but it is not showing anything. I am getting an image path in android app successfully but not showing image (path is like C:/xampp/htdocs/LBS/uploads/San-Coll.png).

Picasso version is com.squareup.picasso:picasso:2.5.1

Android code:

private void showPlacements() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(APIUrl.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create()) //Here we are using the GsonConverterFactory to directly convert json data to object
                .build();

        APIService api = retrofit.create(APIService.class);
        Call<List<Placement>> call = api.showPlacement();

        call.enqueue(new Callback<List<Placement>>() {

            @Override
            public void onResponse(Call<List<Placement>> call, Response<List<Placement>> response) {
                placementList = response.body();
                layoutManager = new LinearLayoutManager(PlacementActivity.this);
                recyclerView.setLayoutManager(layoutManager);

                PlacementAdapter recyclerViewAdapter = new PlacementAdapter(getApplicationContext(), placementList);
                recyclerView.setAdapter(recyclerViewAdapter);


            }

            @Override
            public void onFailure(Call<List<Placement>> call, Throwable t) {

            }
        });
    }

PHP code:

<?php

require 'dbconnect.php';




                // print_r($table);die();

                $sql="SELECT image_path from photos ";

                $result = $con->query($sql);

                $rows = array();

                while($row = $result->fetch_assoc())
                {
                    $rows[] =$row;
                }   
                print json_encode($rows); 




?>
Eduardo Baitello
  • 10,469
  • 7
  • 46
  • 74

1 Answers1

0

i don't think Picasso can load local images; it's mean't to download them from the internet. like https://example.com/imageurl Update: You can: Picasso Load image from filesystem but your server isn't your local filesystem.