I'm trying to read in some large matrices stored in .txt files. My code works fine in my computer (something of which I have a fairly good understanding of how it works), but then not in the Android emulator. This is purely because I don't really have an understanding of the Android file system and I can't seem to access my files correctly. In addition, a lot of other potential solutions I've read have contradicted each other and still don't work for me.
The important part of my code is...
First I use either...
FileInputStream fis = (FileInputStream)con.getResources().openRawResource(R.raw.matrix);
...or...
FileInputStream fis=con.openFileInput("res/raw/matrix.txt");
...then...
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
So what I'm wondering is are either of those two ways to get a file input stream correct? If not, what is the best way. Also, in which directory do I need to save my text files?
Thanks,
Matt
The important part of my code is...
First I use either...
FileInputStream fis = (FileInputStream)con.getResources().openRawResource(R.raw.matrix);
...or...
FileInputStream fis=con.openFileInput("res/raw/matrix.txt");
...then...
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
So what I'm wondering is are either of those two ways to get a file input stream correct? If not, what is the best way. Also, in which directory do I need to save my text files?
Thanks,
Matt