开发者

Canvas.drawText cannot get value from R.string

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜