英文:
Android using Java won't display image using picasa dependence
问题
# Java代码中用于获取图像路径的代码行
jsonObject.getString("image"); // 这是路径
## 我的JSON文件
{
"image": "/Users/jz/Desktop/RwandanMeal/Omellete.jpg"
}
## 日志输出结果
{
"image": "/Users/jz/Desktop/RwandanMeal/ugari.jpg"
}
正如您所看到的,我的路径已经被篡改,这可能是原因之一。
英文:
Line of code in java codes to retrieve image path
jsonObject.getString("image"); // this is the path
My JSON file
"image":"/Users/jz/Desktop/RwandanMeal/Omellete.jpg"
} ```
## Result in logcat
``` {
"image":"\/Users\/jz\/Desktop\/RwandanMeal\/ugari.jpg"
} ```
As you see my path has been manipulated and it could be the reason
</details>
# 答案1
**得分**: 1
Sure, here's the translation:
```java
jsonObject.getString("image").replace("\\", "");
英文:
Remove backslashes
jsonObject.getString("image").replace("\\","");
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论