Jump to content

Im trying to make my APP write a JSON file, how do I go about this? All i could google are how to read JSON on android studio.

Using JAVA BTW. Here is what I wrote so far:
 

try(FileWriter file = new FileWriter("myJSON.json"))
{
    System.out.println("File successfully created!");
}catch(IOException e)
{
    System.out.println("Error Creating file!");
    e.printStackTrace();
}

Just a simple code, I just wanted to make sure I wrote it properly.


I/System.out: Error Creating file!
W/System.err: java.io.FileNotFoundException: myJSON.json (Read-only file system)

 

And that is what I got. Is this the correct way of doing it? Or is there a more easier way?

Processor : i7-6700k (stock speed)

Cooler : Hyper 212X

Motherboard: MSI Krait Gaming Z170

RAM : 4x4gb LPX Memory

Boot Device : Samsung 860 EVO

GPU : ZOTAC 1070 Extreme

PSU :Antec HCG-620M

Link to comment
https://linustechtips.com/topic/1040987-android-studio-and-json-writing/
Share on other sites

Link to post
Share on other sites

2 minutes ago, mshaugh said:

THANK YOU SO MUCH! I didnt know what I was looking for!

Processor : i7-6700k (stock speed)

Cooler : Hyper 212X

Motherboard: MSI Krait Gaming Z170

RAM : 4x4gb LPX Memory

Boot Device : Samsung 860 EVO

GPU : ZOTAC 1070 Extreme

PSU :Antec HCG-620M

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×