在android资源中添加和重用长号码

时间:2020-12-25 08:21:35

I have a constant long number REFRESH_TIME.

我有一个常数长的REFRESH_TIME。

long REFRESH_TIME=24;

(i gave it 24 but it must be long and i don't want use int to long type conversion!)

(我给它24但它必须很长,我不想使用int来进行长类型转换!)

How i could save this long type number in resources (xml resource file ) and re-use it as a long number in my android app?

我如何在资源(xml资源文件)中保存这个长类型的数字,并在我的Android应用程序中重新使用它作为一个长号?

1 个解决方案

#1


0  

These are all the resource types you have in android: Resource Types and More Resource Types.

这些是您在android中拥有的所有资源类型:资源类型和更多资源类型。

The closest you have is Integer (nothing specific for just long), so i don't think you can get rid of the casting int to long.

你最接近的是整数(没有具体的长期),所以我认为你不能摆脱铸造int到long。

Best you can do is find a optimal way for casting it. Answers to this question lists several different ways to do that.

你能做的最好的事情是找到一种最佳的铸造方式。这个问题的答案列出了几种不同的方法。

#1


0  

These are all the resource types you have in android: Resource Types and More Resource Types.

这些是您在android中拥有的所有资源类型:资源类型和更多资源类型。

The closest you have is Integer (nothing specific for just long), so i don't think you can get rid of the casting int to long.

你最接近的是整数(没有具体的长期),所以我认为你不能摆脱铸造int到long。

Best you can do is find a optimal way for casting it. Answers to this question lists several different ways to do that.

你能做的最好的事情是找到一种最佳的铸造方式。这个问题的答案列出了几种不同的方法。