Ci riprovo..
Ho messo un file A.txt nella cartella
%NameProject%/res/drawable-hdpi del mio progetto.
Ora mi piacerebbe leggerlo..
Ecco la funzione che ho scritto..però non funziona e non capisco come mai
codice:
void readFile(String fileName){
// final TextView testo01 = (TextView) findViewById(R.id.TextView01);
// try opening the myfilename.txt
try {
// open the file for reading
InputStream fp = openFileInput(fileName);
// if file the available for reading
if ( fp != null ) {
// prepare the file for reading
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String line;
// read every line of the file into the line-variable, on line at the time
while ( ( line = reader.readLine() ) != null ) {
// do something with the settings from the file
// testo01.setText(line);
}
}
// close the file again
fp.close();
} catch (FileNotFoundException e) {
// do something if the myfilename.txt does not exits
} catch (IOException e) {
}
}
fileName = "@drawable-hdpi/A.txt "
Altra info..
Quando compilerò il progetto questo file A.txt verrà incluso in automatico nel file .apk generato?