Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.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
Android ParseFile.getUrl()';关于空对象引用_Android_Parse Platform - Fatal编程技术网

Android ParseFile.getUrl()';关于空对象引用

Android ParseFile.getUrl()';关于空对象引用,android,parse-platform,Android,Parse Platform,我正在调用parse cloud中的图像,并使用毕加索将它们加载到我的gridview支架中 这是doInbackGround @Override protected Void doInBackground(Void... Params) { feedsarraylist = new ArrayList<ParseFeeds>(); try { ParseQuery<ParseObject&

我正在调用parse cloud中的图像,并使用毕加索将它们加载到我的gridview支架中

这是doInbackGround

@Override
       protected Void doInBackground(Void... Params) {
           feedsarraylist = new ArrayList<ParseFeeds>();
           try {
               ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("AroundMe");
               query.orderByDescending("createdAt");
               //query.whereWithinKilometers()
               ob = query.find();

               for (ParseObject feeds : ob) {
                   ParseFile thumb = (ParseFile) feeds.get("videoThumbs");
                   //ParseFile video = (ParseFile) feeds.get("file");
                   ParseFeeds map = new ParseFeeds();
                   //map.setImage(thumb.getUrl());
                  //Uri videoUri = Uri.parse(video.getUrl());
                   map.setImage(thumb.getUrl());
                   feedsarraylist.add(map);
               }

           } catch (ParseException e) {
               Log.e("ParseException", "parse: " + e);
           }
           return null;
       }
这是我将其加载到GridViewAdapter.class的地方

  Picasso.with(context).load(feedsarraylist.get(position).getImage()).into(holder.ThumbView);
Logcat详细信息

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.parse.ParseFile.getUrl()' on a null object reference
                                                                              at com.teamtreehouse.ribbit.FeedsFragment$RemoteDataTask.doInBackground(FeedsFragment.java:67)
                                                                              at com.teamtreehouse.ribbit.FeedsFragment$RemoteDataTask.doInBackground(FeedsFragment.java:45)

我只是在这里猜测,因为您没有指定错误发生的位置

ParseFile thumb = (ParseFile) feeds.get("videoThumbs");
map.setImage(thumb.getUrl())

如果
feeds
没有
videoThumbs
元素,
thumb
将为
null
,因此您会出错。检查
提要
元素的内容。

我在这里只是猜测,因为您没有指定错误发生的位置

ParseFile thumb = (ParseFile) feeds.get("videoThumbs");
map.setImage(thumb.getUrl())

如果
feeds
没有
videoThumbs
元素,
thumb
将为
null
,因此您会出错。检查您的
提要
元素的内容。

我在解析类中有videoThumbs列。您对此有什么解决方案吗?@Savita您最好确保您的
解析文件
包含
videoThumbs
。记录并找出设置
videoThumbs
失败的位置。可能是在你得到它之后设置的。只需调试你的代码并检查提要的值。@RvdK我已经添加了logcat。videoThumbs列确实存在于我的解析类中。我在解析类中有videoThumbs列。您对此有什么解决方案吗?@Savita您最好确保您的
ParseFile
包含
videoThumbs
。记录并找出设置
videoThumbs
失败的位置。可能是在你得到它之后设置的。只需调试你的代码并检查提要的值。@RvdK我已经添加了logcat。videoThumbs列不存在于我的解析类中