0

I'm trying to load an image from the url that was provided by google place's json response and putting it in an Imageview Layout that's going to show when a marker is clicked. I get no error in run-time or in debug but the image will not display on the Imageview. Is there anything that may cause this?

My Layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/places"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="horizontal"
android:background="@drawable/mapinfoborder">

<ImageView
    android:id="@+id/place_badge"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:adjustViewBounds="true" />

<TextView
    android:id="@+id/place_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:textColor="#ffffffff"
    android:layout_below="@+id/place_badge"
    android:paddingTop="5dp"
    android:textSize="20dp"
    android:gravity="center"
    android:text="TitlePlaceHolder"/>

<TextView
    android:id="@+id/place_snippet"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/place_title"
    android:paddingTop="5dp"
    android:textColor="#ffffffff"
    android:textSize="16dp"
    android:gravity="center"
    android:text="SnippetPlaceHolder"/>

    </RelativeLayout>

Calling it in my activity:

    View v = inflater.inflate(R.layout.places_layout, null);
    placeImage = (ImageView) v.findViewById(R.id.place_badge);
    ...
    Picasso.with(getApplicationContext())
                        .load(markerPlaces.get(marker.getId())).placeholder(R.drawable.bus)
                        .into(placeImage);

Again I get no error so there's really no usable logcat that I can provide. Any comments/ideas/suggestions are appreciated.

Masterofawesome
  • 69
  • 1
  • 11
  • look at this http://stackoverflow.com/a/17939885/4826114 for error handling – eddykordo Jul 23 '15 at 21:55
  • i think the problem with this one is, you created a new view, but you didn't attach it to the activity-view. Or did you in ...? – JohnnyAW Jul 24 '15 at 16:22
  • Thanks for the replies! I figured out what was going on. It wasn't that the image wasn't loading, it just loads it slow. I'm trying to optimize it which is probably another question on another thread! – Masterofawesome Jul 27 '15 at 15:47

1 Answers1

0

Can you try with this

View v = inflater.inflate(R.layout.places_layout, null);
placeImage = (ImageView) v.findViewById(R.id.place_badge);
...
Picasso picasso = Picasso.with(getApplicationContext());
picasso.invalidate(market.getId());
picasso.load(markerPlaces.get(marker.getId()))
    .placeholder(R.drawable.bus)
    .into(placeImage);
Bajji
  • 2,243
  • 2
  • 22
  • 35