1

I am working on an application that reads student names into a spinner and than displays their grades. The names and grades are contained within a grades.txt file, when the user selects a name, for example: Adam Anderson the output would display Test 1: 81, Test2: 90, Test3: 85, Final 87 and than save their overall average. The problem I am having, I've always used string data to populate a spinner and I've called my data accordingly.

Our teacher said use:

AssetManager am = getAssets();
InputStream inputFile = am.open(“grades.txt”);

But never elaborated, instead he said refer to Google documentation for help or Android Studio. I've done some Googling, but I am still confused on what he means by using those two lines of code and I am hoping someone can shed some light on it.

THank You

Name            Test1   Test2   Test3   Final
Adam   Anderson 81      90      85      87
Ben    Brown    77      80      68      94
Chris  Cross    74      80      56      62
Don    Dare     86      94      90      89
Eric   Earl     96      93      90      98
Fred   Foley    79      92      59      86
Gina   Gray     80      83      95      87
Holly  Hank     74      77      75      78
Ian    Ingram   66      64      56      60
Jill   Johnson  90      98      78      89  
Justin R
  • 198
  • 9
  • 1
    Take a look at this http://stackoverflow.com/questions/18302603/where-to-place-assets-folder-in-android-studio – Titus Oct 04 '15 at 18:59
  • 1
    Where is your text file stored? AssetManager is used to manage assets in your raw folder that is res/raw. If this is where your text file is stored that approach is fine. – Adam W Oct 04 '15 at 19:00
  • Yes grades.txt is stored and my assets folder – Justin R Oct 04 '15 at 19:07
  • Wow, you did actually type the table! :) – Onik Oct 04 '15 at 20:43

0 Answers0