1. Are you ready for the Galaxy S20? Here is everything we know so far!

Reading file from assets

Discussion in 'Android Development' started by beginnerProgrammer, Apr 22, 2020.

  1. beginnerProgrammer

    Thread Starter

    I am very new to android programming but I want to read a json file using async task, which seemed to work properly when I used a json file that was on a website (using http connection), but now I would like to do the same thing with my own json file. I have an assets folder called 'assets' where I've put my jsonFile.json.

    I tried to open it using getAssets().open(), but that doesn't seem to work. Also my listFragment class (from which the loadJson is called, does not contain a context, so I can't parse the context from listFragment onto loadJson.

    Is there anyone who knows how to help?


    Attached Files:

    1. Download the Forums for Android™ app!



Share This Page