如下面的代码所示,我想列出所有keys
包含在bundle
中使用方法Set<String> set = compositeBundle.keySet();
我尝试显示变量 set
的内容使用set.toString()
但它返回类似 xxxxx@xxxx
的内容
如何显示变量Set <String> set
的内容?
代码:
Bundle compositeBundle = getMeetingPointFixDataInBundle(getNewMeetingPointFixBundle(), locLatEt, locLngEt,
almanec.getTime(), almanec.getDate());
//separateBundleData(compositeBundle);
Set<String> set = compositeBundle.keySet();
Log.d(CURRENT_ACTIVITY, "Lsit of the KEYS contained in the Bundle is, "+set.toString());
最佳答案
使用组合
http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#toString(java.lang.Object[])
和
http://docs.oracle.com/javase/7/docs/api/java/util/Set.html#toArray()
你可以做
Arrays.toString (set.toArray ());
关于java - Set<String> 类型的变量返回不可读的输出格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23822814/