Skip to content Skip to sidebar Skip to footer

Android How To Create File In Phone Memory

How do i create a file in phone memory instead of SD card.

Solution 1:

You should only have access to the directories possessing the correct access rights for your application.

Usually, you will use the method Context.getDir("example", MODE_PRIVATE) to get a writeable directory on the phone memory.

It creates a directory called /data/data/[package_name]/app_example.

You will then be able to create files in that directory.

You can also use :

FileOutputStreamf= context.openFileOutput("filetest", MODE_PRIVATE);

which will create and open a file named /data/data/[package name]/files/filetest.

Post a Comment for "Android How To Create File In Phone Memory"