I'm developing a travel app. On Google map API V2 feature, I want each InfoWindow have an different image.
I've override WindowInfoAdapter for custom title and detail text.
public class MyInfoWindowAdapter implements InfoWindowAdapter {
private final View mView;
public MyInfoWindowAdapter(Activity activity) {
mView = activity.getLayoutInflater().inflate(R.layout.custom_info_window, null);
}
@Override
public View getInfoContents(Marker marker){
String title = marker.getTitle();
final String snippet = marker.getSnippet();
final TextView titleUi = (TextView) mView.findViewById(R.id.title);
// final View subtitleUi = mView.findViewById(R.id.subtitle);
final TextView snippetUi = ((TextView) mView.findViewById(R.id.snippet));
final TextView placeid = ((TextView) mView.findViewById(R.id.placeid));
final RatingBar voteUi = ((RatingBar) mView.findViewById(R.id.ratingBar1));
final ImageView imageUi = ((ImageView) mView.findViewById(R.id.imageView1));
titleUi.setText(title);
//other code
return mView;
}
@Override
public View getInfoWindow(Marker marker){
return null;
}
}
It work fine because It's String.
Now I want to add an image on that InforWindow using ImageView.
The problem appear because I used image from asserts and stream. It's something like this
InputStream ims = getSherlockActivity().getAssets().open("images/" + imageSubPath + "/" + splitedImages[i].toLowerCase());
Drawable iImages = Drawable.createFromStream(ims, null);
I can't put Drawable object to snippet as I did with String before. The result I want here:
How can I display images on InfoWindows, any advices are great!