问题描述
所以我不编程这样的新手,Java或Android的发展,但我得到了一个奇怪的问题:我已经提出了申请,相当先进,而且有它的市场。
So I am not such a newbie in Programming, Java or Android developing, but I got a strange issue: I have made an application, quite advanced, and have it on market.
现在我有超过1000安装和我有一个ResourceNotFoundException约4或5崩溃报告。最奇怪的是,它崩溃上线是
For now I have over 1000 installs and I have around 4 or 5 crash reports for a ResourceNotFoundException. The strangest thing is that the line it crashes on is on
setContentView(R.layout.some_custom_layout)
在code我总是指的是通过资源
In code I am always referring to resourced by
someTxtView.setText(R.string.some_string)
如果我用了所以我想知道
So I am wondering if I used
mContext.getResources().getDrawable(mContext.getResources().getIdentifier("some_string", "string", "my.example.package"));
会崩溃消失?
推荐答案
我面临着同样的问题,我通过创建布局文件夹固定它称为布局小。
I was facing the same issue and I fixed it by creating Layout Folder called "layout-small".
根据我只创建了2个文件夹的决议布局大和布局中。但几部电话都具有较低的分辨率没有找到合适的资源,根据该决议。 Android操作系统呈现XML资源单位分辨率。它会在需要的文件夹中找到的资源。
Based on resolutions I have created only 2 folders "layout-large" and "layout-medium". But few phones are having lower resolution it doesn't find proper resources as per the resolution. Android OS renders xml resources as per resolution. It goes and find the resources in required folders.
其具有符合布局正常文件夹中分辨率95+%的Android手机。但还是有具有较低分辨率的手机。因此出现了这种问题。
95+ % Android phones having resolution which matches "layout-normal" folder. But still there are Phones having lower resolution. Hence this issue occurred.
有关更多细节:
希望这有助于你的问题。
Hope this helps your problem.
这篇关于Android的未发现的资源例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!