ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();
//Save
for(int i=0;i<5;i++) {
HashMap<String,String> tempMap = new HashMap<String,String>();
String name = "server"+i;
String mac = "11:22:33:44:55:6"+i;
tempMap.put("DEVICE_NAME",name);
tempMap.put("DEVICE_MAC",mac);
peripheralScanResultList.add(tempMap);
}
//Get
for(HashMap<String, String> tempMap: peripheralScanResultList) {
Iterator<String> iterator = tempMap.keySet().iterator();
while( iterator.hasNext() ){
String key=(String)iterator.next();
String value=(String)tempMap.get(key);
Log.i(TAG, key + ", " +value);
}
}
沒有留言:
張貼留言