开发者

Canvas.drawText cannot get value from R.string

开发者 https://www.devze.com 2023-03-15 09:42 出处:网络
i use canvas in overlay class. Code canvas.drawText(getString(R.string.de开发者_高级运维stination), (float) point2.x+4, (float) point2.y+4, paint);

i use canvas in overlay class. Code canvas.drawText(getString(R.string.de开发者_高级运维stination), (float) point2.x+4, (float) point2.y+4, paint); error is no resource found. i tried

final Resources r = Resources.getSystem();

r.getString(android.R.string.untitled);

and

getResources().getString(R.String.nameHere); 

but cannot solve it. anyone can help me


Sometimes eclipse won't update the R-class properly. Then try to clean/close+open your project.


Check your imports to make sure you've imported your R class, not android.R class. Getting strings is usually done by activity.getResources().getString(int id). Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号