Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 毕加索使用mysql url在arraylist hashmap中加载图像_Java_Arraylist_Hashmap_Picasso - Fatal编程技术网

Java 毕加索使用mysql url在arraylist hashmap中加载图像

Java 毕加索使用mysql url在arraylist hashmap中加载图像,java,arraylist,hashmap,picasso,Java,Arraylist,Hashmap,Picasso,问题: 我想使用毕加索将我的图像URL转换为图像 解释: 使用JSON查询,从数据库接收数据。数据包含一个URL,我想将其转换为图像(最好使用毕加索) 它现在做什么: 所有数据都放在ArrayList中。检索数据时,所有数据都会显示exept图像(在XML中使用ImageView) 我尝试的 把毕加索的所有选项放在任何地方,但我不知道如何在ArrayList或HashMap中使用毕加索 代码 这里是我想要实现的代码片段。如果需要更多,我将添加更多 OnCreate之前的一段代码 ArrayLis

问题:

我想使用毕加索将我的图像URL转换为图像

解释:

使用JSON查询,从数据库接收数据。数据包含一个URL,我想将其转换为图像(最好使用毕加索)

它现在做什么:

所有数据都放在ArrayList中。检索数据时,所有数据都会显示exept图像(在XML中使用ImageView)

我尝试的

把毕加索的所有选项放在任何地方,但我不知道如何在ArrayList或HashMap中使用毕加索

代码

这里是我想要实现的代码片段。如果需要更多,我将添加更多

OnCreate之前的一段代码

ArrayList<HashMap<String, String>> recipesList;

因为map.put返回

与键关联的上一个值,如果没有,则为null 键的映射。(null返回也可以表示映射 如果实现支持,则以前将null与键关联 空值。)

在您的示例中,特定键的上一个映射值为null。您可以将代码修复为

...
map.put(TAG_PHOTO, photo);
Picasso.get().load(map.get(TAG_PHOTO));
...

因为map.put返回

与键关联的上一个值,如果没有,则为null 键的映射。(null返回也可以表示映射 如果实现支持,则以前将null与键关联 空值。)

在您的示例中,特定键的上一个映射值为null。您可以将代码修复为

...
map.put(TAG_PHOTO, photo);
Picasso.get().load(map.get(TAG_PHOTO));
...

谢谢你,但这并没有解决问题。logcat出错:W/ImageView:resolveUri在错误的位图uri上失败:http://...@你在真实设备上调试你的应用程序吗?我使用虚拟设备。我也会把它移植到我的手机上。编辑:不,真实设备上也没有图像。@Koetjeboe尝试打开您的图像http://.. 通过设备的internet浏览器检查可访问性。这似乎不是毕加索的问题。这幅画画得很好。在另一个选项卡上(当配方被点击时),毕加索加载了完美的图像(普通页面,而不是数组列表),对此表示感谢,但这并没有解决问题。logcat出错:W/ImageView:resolveUri在错误的位图uri上失败:http://...@你在真实设备上调试你的应用程序吗?我使用虚拟设备。我也会把它移植到我的手机上。编辑:不,真实设备上也没有图像。@Koetjeboe尝试打开您的图像http://.. 通过设备的internet浏览器检查可访问性。这似乎不是毕加索的问题。这幅画画得很好。在另一个选项卡上(单击配方时),毕加索加载完美图像(普通页面,而不是阵列列表)
  /**
  * Updating parsed JSON data into ListView
  * */
 ListAdapter adapter;
 adapter = new SimpleAdapter(
      ActivityTwo.this, recipesList,
      R.layout.activity_two_details_cards, new String[] { TAG_PID,
      TAG_NAME, TAG_PRICE, TAG_TIME, TAG_PHOTO},
      new int [] { R.id.pid, R.id.name, R.id.price, R.id.time, R.id.imagePhoto});// updating listview
      setListAdapter(adapter);
      }
...
map.put(TAG_PHOTO, photo);
Picasso.get().load(map.get(TAG_PHOTO));
...