I see how to mount an SD card in the emulator, but I'm not sure how you move files back and forth between the userdata image and the SD card image. Can someone tell me how to do this?
The first thought that comes to my mind is to first transfer the data from the userdata image file to local filesystem and then transfer back from local to sdcard image.
adb pull /data/data/com.example.sample ./sample/
adb push ./sample/ /sdcard/sample/
hope I interpreted your question correctly.
Related
I am a bit confused on where and how Camera images get stored. So I have an API 22 emulator ran on an SD and the below code will only work if ran using an SD card. I then take a couple of pics and see the pictures in the gallery and the camFiles array will get populated.
However, it does not work with API 23/24 emulators even with SD card. Is there a way to get the default camera directory that'll work for any API level?
File cameraDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString());
File[] files = cameraDir.listFiles();
//gets the 'Camera' directory
File finalCamDir = files[0];
File[] camFiles = finalCamDir.listFiles();
Is there a way to get the default camera directory that'll work for any API level?
Not really. There is no single "default camera directory". There are thousands of Android devices, with hundreds of different pre-installed camera apps, in addition to camera apps that users install themselves. It is up to the developers of those camera apps to decide where to save photos on the device.
DIRECTORY_DCIM is a recommended starting point. Some camera apps will put photos directly in this directory. Others, such as Open Camera, will use a subdirectory off of DIRECTORY_DCIM (e.g., OpenCamera/). Others are welcome to store their photos wherever they want, not necessarily involving DIRECTORY_DCIM.
HelloEveryone! I want to know some principal thing. Is there exists a method to take a picture (with good resolution) from android device without saving it in hard memory (only in RAM). I tried to:
use TakePicture(shutter, raw, jpg), but resolution of the resulting JPG is very low and RAW working with very few number of devices. Was asked here
give the control to Google Camera, but this way required some temporary file in the hard memory (to write picture)
How can I do this. Or is it impossible? Any help! Thank you!
It depends on your phone. Many phones do not need external sd card because they already have a internal one. So I suggest you check the hardware information of your phone first. If it do not have a external sd card, you can try to use camera2
to take videos and pictures. Pictures and videos can be stored in RAM. But if you want to access the pictures stored in RAM, you need to root your phone first.
Is there any way of saving the screenshot taken by MonkeyRunner's device.takeSnapshot() to the phone's internal storage itself? This example I have seen on the net only saves it to the computer where the MonkeyRunner command is executed.
http://www.vogella.com/tutorials/AndroidTesting/article.html#monkeyrunner_example
Try using:
device.shell('screencap -p /sdcard/sc.png')
this will save the screen capture to your sdcard.
i edited an existing emulator to have an sd card of size 9mb and i added a boolean in the hardware section to support sd card. when i start the app it says "your SD card is full", what do?
First, try making the SD card larger - like, 100 MB - and restarting the emulator. The boolean in the hardware section, IIRC, triggers the preferred location for the application's APK - internal memory or SD card. An APK of 9MB is not that uncommon.
The problem is that your SD card size has been declared too small. Consider the practicability of a user having a 9MB SD card when the whole world is talking in GBs.
Edit the emulator and increase the size, atleast to a hundred as depending upon your application, you might be needing a lot of space.
However, see this post regarding a known issue on SD card size.
I have created some text files in the SD card, but I am unable to view my files.
I am using this path Environment.getExternalStorageDirectory(); to create files.
I am not getting any exception while creating files.
when I open the DDMS in eclipse I am unable to see my files there also..
If I created the files at
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
then I can see my files at /data folder of the device , but not in SD card itself.
When I click on the gallery icon in my device, I can see only pictures, videos, camera shots folders only but not my files ..
please suggest is that the proper way of creating files in SD card.
thanks.
Environment.getExternalStorageDirectory() doesn't always return the location to an external card. On android tablets (Android 3.0+) this directory is often mounted in the internal memory.
From the docs:
Note: don't be confused by the word "external" here. This directory
can better be thought as media/shared
storage. It is a filesystem that can
hold a relatively large amount of data
and that is shared across all
applications (does not enforce
permissions). Traditionally this is an
SD card, but it may also be
implemented as built-in storage in a
device that is distinct from the
protected internal storage and can be
mounted as a filesystem on a computer.
AFAIK there is no generic way to determine the mountpoint of an sdcard, this is specified by the device manufacturer. For example the ASUS Transformer mounts the external cards in /Removable/MicroSD and /Removable/SD . The "External Storage" directory /sdcard/ is mounted in internal space.