Android Studio并未显示某些项目的所有相关XML。

huangapple go评论167阅读模式
英文:

Android studio not showing all releavant xml for certain items

问题

developers!我是 Android 开发的新手。我遇到了一个问题,即模拟器未能从 JSON 对象中渲染图像和标题。模拟器显示加载日志,因此我认为这不是硬件问题。另外,我注意到网络在调试运行时能够从 API 网站(Edamam API)获取 JSON 数据。我正在使用 Retrofit 调用 Edamam API。我已经修复了 LogCat 中的所有错误,除了以下内容外,我没有看到任何错误:

> E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping
> 设备类型=5,返回值=-1

当 Logcat 中没有错误时,你会怎么做?有什么建议吗?我已经花了很长时间在这上面,但仍然无法找到解决方案。
我尝试过:

  • 从模拟器中卸载应用
  • 更改适配器实现代码
  • 更改模拟器设备,多次添加字段、方法、getter 和setter 到各个类中
  • 添加 Log.d 以查看出现问题的位置
  • 等等... 我记不清楚了

这是我的代码:https://gist.github.com/Kijimu7/a8fb50a265618e6f0356c2e3277c90e3

非常感谢任何建议!

英文:

developers! I am new to Android development. I am facing an issue that the emulator is not rendering images and titles from JSON objects. The emulator is showing a loading log so I don't think it is an issue of hardware. Also, I see that network is working to getting JSON data from the API site (Edamam API) when I run debug. I am using Retrofit for making a call of Edamam API. I fixed all the errors from LogCat and I don't see any errors except

> E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping
> failed for device_type=5, ret=-1

What do you do when you don't have an error in Logcat? Any suggestions? I have been working on this long time but not able to get the solutions.
What I tried...

  • Uninstall the app from the emulator

  • Changed adapter implementation code

  • Changed emulator devices Added fields, methods, getter, and setter
    on multiple classes

  • Added Log.d too see where I am having a problem

  • etc.. that I don't remember

Android Studio并未显示某些项目的所有相关XML。

This is my code https://gist.github.com/Kijimu7/a8fb50a265618e6f0356c2e3277c90e3

Any suggestions appreciated!

答案1

得分: 0

我能够解决这个问题。
在 CustomAdapter.java 文件中,我的 id 引用布局文件时出现了一个拼写错误。
另外,我修复了 MainActivity.java 中的 onResponse 如下:

adapter.addAll(response.body().getHits());

以在 MainActivity.java 上调用 Hits 对象。

英文:

I was able to solve this problem.
I had a typo on my id to reference the layout file on CustomAdapter.java.
Also, I fixed the onResponse to

adapter.addAll(response.body().getHits());

to call Hits objects on MainActivity.java.

huangapple
  • 本文由 发表于 2020年10月27日 06:38:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/64545953.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定