java - AndroidStudio can't find CSV file. Tried Absolute File Path & Relative File Path -


i've created simple android app displays text user.

now i'm attempting implement csvreader retrieve text csv file. after hours of trying different things.

i implemented open source csvreader (at least it's not giving me compile errors anymore).

now when run app, crashes , "file not found" exception. either i'm not placing csv file in correct location, i'm not referencing correct file path, or both.

i've tried using absolute file path (ex. starting c:/users/tim/androidstudioprojects/...).

i've tried using relative path starting assets folder (ex. "assets/social_posts.csv") , nothing i've tried has worked.

i've tried looking similar questions on stack overflow, , i've tried several variations of file paths , nothing has worked far. think should try next?

here link project on github.

the code pointing csv file under

app > src > main > java > com > example > tim > inspiredquestions 

the csv file called social_posts.csv , under

assets > social_posts.csv 

final note: i've used stackoverflow debugging year now, first question i've asked.

thank-you patience! i'm trying self-reliant can, i'm going on limb , asking help. i'm sure problem has simple answer i'm overlooking.

i figured out answer. added final csvreader csvreader = new csvreader(new inputstreamreader(c.getassets().open("social_posts.csv") load function in game.java after looking @ answer this question. had put csv file in assets folder under app/src/main didn't know how access file until reviewing post.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -