1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
@TargetApi(Build.VERSION_CODES.KITKAT)
void loadMap(String file){
try( Scanner scanner = new Scanner( new InputStreamReader( openFileInput(file) ) )){
String word = scanner.next() ;
//
word = new String(scanner.next()) ;
while ( scanner.hasNext()){
switch (word ){
case "OBJECT" :
String name = new String(scanner.next());
int x= new Integer(scanner.nextInt()) ;
int x= new Integer(scanner.nextInt()) ;
//etc...
//je charche les données sans problème, même les objets, les graphismes etc...
//mais si j'essaye de les ajouter dans un container, il me bloque et m'affiche l'erreur de mémoire.
ex : objects.add(objectCharge);
}
}
break ;
}
word = new String(scanner.next()) ;
}
}catch (IOException e) {
}
} |
Partager