按 ID 查找视图仅适用于某些设备
我正在尝试构建一个 Android 应用程序。 该应用程序需要 android 2.2 和 Google Apis(用于 Google 地图)。
- 当我在 2.2 Android 模拟器上启动该应用程序时,它可以正常工作。
- 当我在运行 Android 2.3.7 的 Galaxy S II 上启动该应用程序时 (氰模组)它有效。
- 但是当我在 HP 上启动该应用程序时 具有相同版本 Cyanogen mod 的触摸板在 findViewById 返回 null 后开始!
我已经重建了项目,清理了它等等......并且它没有改变任何东西。 知道什么会导致这种行为吗?
I am trying to build an android application.
The application requires android 2.2 and Google Apis (for Google Maps).
- When I launch the application on a 2.2 Android emulator, it works.
- When I launch the application on a Galaxy S II with Android 2.3.7
(Cyanogen mod) it works. - But when I launch the application on a HP
Touchpad with the same version of the Cyanogen mod it fails at the
beginning after a findViewById returned null!
I have rebuilt the project, cleaned it etc... and it didn't change any thing.
Any idea of what could cause this kind of behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用替代布局吗?即“res/layout-large”、“res/layout-small”等。
如果是这样,请确保您要查找的视图出现在所有不同的布局中。
Are you using alternative layouts? i.e. 'res/layout-large', 'res/layout-small', etc.
If so, make sure the view you are trying to find appears in all of the different layouts.