【发布时间】:2015-03-09 11:37:52
【问题描述】:
这个问题可能有点明显,但情况如下:
在我的应用程序(googleMaps v2)中,我有一个自定义标记,它有一个图像视图(从相机意图拍摄的图像)。因此,一旦应用程序在 SQlite 数据库中重新启动,我已经保存了再次加载图像所需的所有信息。但问题是,当尝试将图像加载到布局充气机时,没有显示任何内容,但是当我在我的活动中创建 Imageview(即不在布局充气机中)时,图像会显示出来,但显然在我没有的地图上'不想。
所以这是我从相机意图返回时在 ImageView 中加载图像的代码(这有效)
@Override
public View getInfoContents(Marker marker)
{
View v = getLayoutInflater().inflate(R.layout.infowindow_layout, null);
ImageView markerIcon = (ImageView) v.findViewById(R.id.PicView);
Bitmap bitmap = myMarkersHash.get(marker.getId());
markerIcon.setImageBitmap(bitmap);
然后当应用重启时尝试从数据库加载:
filep = arg1.getString(arg1.getColumnIndex(LocationsDB.FIELD_FILEPATH));
....
View view = getLayoutInflater().inflate(R.layout.infowindow_layout, null);
ImageView image = (ImageView) view.findViewById(R.id.PicView);
Bitmap myImage = BitmapFactory.decodeFile(filep);
image.setImageBitmap(myImage);
然后什么都不显示
谁能告诉我为什么图片不显示? PS没有错误消息或任何我可以添加到这个问题的东西。
【问题讨论】:
-
您确认 filep 返回正确的值了吗?你的代码在哪里使用了 filep?