How To Put A Picture In The Internal Memory Of The App?
Solution 1:
Your apk file is somthing like an android app installation file. It is a zipped file, you can also open it with 7-Zip or a similar program. When you install an app on your device the file will be extracted to your internal memory.
URI stands for Uniform Resource Identifier. It identifies your resource, in your case the taken picture.
You can save the picture to your internal or external memory. If you want to use the external memory you need permissions:
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>If you save the file to your internal memory its is invisible to other apps and you cannot find it with af file explorer. If it is external you will find it in your file explorer.
Check this answer on Stackoverflow on how to save your camera file:
Intentintent=newIntent(MediaStore.ACTION_IMAGE_CAPTURE); fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name// start the image capture Intent startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);Then, in onActivityResult, replace data.getData() with fileUri.toString() and it will solve your problem.
Solution 2:
Well apk file means its bundle of your all class files, resources files(images,videos etc), validation certificate files and many more. As per your asset folder it will consider as resources files only the way it treated in programing is different. Once generated apk file in running environment its get converted dex files. You cannot modify the contents of the file.
As i said above saving at this path not possible. appname/app/src/main/assets/photos
But you can make you app internal memory, You can create files and use the when you want.
Solution 3:
There is no way to save photos which you are taking from the camera app, because those photos are created in runtime and files in your source folder ("appname/app/src/main/assets/photos") have to be added in compile time (even before compile time).
Solution 4:
You can not change assets value after your apk generation you can only do that store your photos in to data\data\yourpackagename\photos but this thing will increase you app size in device
Solution 5:
An apk file consists of :
assets, META-IFN, res foulder.
AndroidManifest.xml, classes.dex and resources.arsc
Once deployed on a device, apk generates a folder, typically in /data/data/your.package.name/ .
What i encourage you to do is save the files in the dedicated areas.
Post a Comment for "How To Put A Picture In The Internal Memory Of The App?"