我有3个布尔值,它们指示是否应该将一个整数添加到列表中,然后我想在这个列表上使用TextUtils.join()。
我应该如何继续?
ArrayList<Integer> types = new ArrayList<Integer>();
if (m_bWithA) {
types.add(this.TYPE_A); //TYPE_A is an int
}
if (m_bWithB) {
types.add(this.TYPE_B);
}
if (m_bWithC) {
types.add(this.TYPE_C);
}
TextUtils.join("|", types);但是它说我们只能在Object[]上使用TextUtils.join()。
我应该使用另一个函数还是不同类型的对象?
发布于 2012-09-13 18:58:02
使用TextUtils.join(types.toArray())
https://stackoverflow.com/questions/12404651
复制相似问题