0
我正在嘗試使android應用程序顯示餐館附近的用戶。 我有一個谷歌地圖顯示,並添加標記與餐館。當用戶點擊標記時,它會顯示信息。餐廳的標題,評級和圖標(如果存在)。 即時通訊使用Place search我得到每個餐廳的信息。 它的工作,但當我試圖顯示它顯示爲空的圖標。顯示圖標在谷歌地點marker.title
聽到的是,即時通訊試圖讓reaturant
private InputStream OpenHttpConnection(String urlString)
throws IOException
{
InputStream in = null;
int response = -1;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException("Not an HTTP connection");
try{
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
httpConn.connect();
response = httpConn.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
in = httpConn.getInputStream();
}
}
catch (Exception ex)
{
throw new IOException("Error connecting");
}
return in;
}
private Bitmap DownloadImage(String URL)
{
Bitmap bitmap = null;
InputStream in = null;
try {
in = OpenHttpConnection(URL);
bitmap = BitmapFactory.decodeStream(in);
in.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return bitmap;
}
的圖像,並顯示它
//Getting icon
String iconURL = hmPlace.get("iconURL");
Bitmap bitmap = DownloadImage(iconURL);
markerOptions.title(name + " : " + bitmap);