我想实现短信文本计数器一样的功能,因为在Android的默认消息应用程序。因此,在每161个字符计数器应该递增1之后,并且在删除字符时,它应该递减。
发布于 2011-01-21 00:21:56
Math.floor(chars / 160) + 1
这将把您拥有的字符数除以SMS-limit (160),去掉小数位并加上"1“。
http://www.java-examples.com/find-floor-value-number-using-math.floor
例如chars = 170,则(chars / 160) = 1,0625,floor( 1,0625) =1,结果是170个字符表示2条短信。
发布于 2011-01-21 00:14:49
类似于:
int countSMS = (nbOfCharacters / 160) + 1;
https://stackoverflow.com/questions/4749403
复制相似问题