Created
June 8, 2016 14:51
-
-
Save devflow/d4e97ecc258787bae4ac1a0877b314a1 to your computer and use it in GitHub Desktop.
android-async-http file array.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, ArrayList<File>> fileMaps = new HashMap<>(); | |
for (QueryParam queryParam : queryParams) { | |
if(queryParam == null) continue; | |
String type = queryParam.type; | |
if (type.equalsIgnoreCase("string")) { | |
requestParams.add(queryParam.key, queryParam.val); | |
} else if (type.equalsIgnoreCase("file")) { | |
try { | |
if(!fileMaps.containsKey(queryParam.key)){ | |
fileMaps.put(queryParam.key, new ArrayList<File>()); | |
} | |
fileMaps.get(queryParam.key).add(new File(queryParam.val)); | |
//requestParams.put(queryParam.key, new File(queryParam.val)); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
for (String key : | |
fileMaps.keySet()) { | |
ArrayList<File> files = fileMaps.get(key); | |
try { | |
requestParams.put(key, files.toArray(new File[files.size()])); | |
}catch (Exception e){ | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment