我试图从偏好中找到一组的lentgh.我累了set.length,但它不起作用.任何人都知道另一种方法来找到一组长度?
set = prefs.getStringSet("key", null);
int X = set.length; //it doesn't like length....
Run Code Online (Sandbox Code Playgroud)
你的集合是 a Set<String>,而不是 a String[]。所以你必须打电话:
int x = set.size();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30279 次 |
| 最近记录: |