Move an entire folder from windows to Android emulator - android

Is it possible to move an entire folder as is from windows to an android emulator? - I am sure the answer to this exists somewhere but I am not able to find it. I can move one file at a time either via adb command line or via ddms but neither gives me the option to move entire folder with multiple folders and files inside and when I try to it gives me this error
C:\>adb push C:\Users\peng-lp-10\Desktop\ABC\ /mnt/sdcard/ABC/
cannot stat 'C:\Users\peng-lp-10\Desktop\ABC\': No such file or direct
ory
even if the folder exists.

Look at this question,furikuretsu says:
you can simply drag any sets of files and folders to File Explorer (a window in DDMS perspective). No
need of using arrow icons.
It works fine.

Related

Can`t find mnt/sdcard in Android device monitor

I want to push an image in gallery but cant findmnt/sdcard` folder as shown in this image:
check below image,
Tools -- Android -- Android Device Monitor
In that, select emulator and on right side move to folder
data -- data -- your application package name -- it will show your
files
see /storage folder. This is the sdcard in emulator.

Android: viewing files from Windows explorer

I have just made an application that uses a SQLite database, and I finally managed to export the database file onto the computer without having to root the Android device. The method I am using is mostly from code I found on various Stack Overflow question/answers. I am basically saving the database file to the public Download folder.
When I look on the Android device using a file explorer, I can see the correct SQLite file in the correct folder (Download folder). However, when I open up the same folder in Windows Explorer from my PC, I can not see the file in the exact same folder.
Now here is the strangest part: When I copy or move the file (using the Android device), even if I am copying and/or moving the file TO THE EXACT SAME SPOT, as soon as I have finished doing this the file instantly becomes visible in Windows Explorer.
I do not want the user to have to do this manually every time, so does anyone know of any way to make sure that the file will be visible right away? Thank you in advance!
Things I have tried so far:
Show hidden files and folders in Windows Explorer
Programmatically moving the file to a new folder within the application itself (the move to the new folder works, but the file still remains invisible in Windows Explorer until manually moving/copying the file again)
Searched StackOverflow for similar issues and have been unsuccessful.
And if anyone wants to see some of my code, let me know and I will post it, but I am thinking that this is less to do with my code and more to do with Android/Windows interaction. And this is where I got my move folder function from: stackoverflow.com/questions/4178168/how-to-programmatically-move-copy-and-delete-files-and-directories-on-sd
Thank you!
I had a similar issue and it was not visible in Windows because I hadn't given it a file extension.
Give it a file extension if you haven't already.

Android file explorer - Eclipse

I am saving data internally to the phone in Eclipse, and I was told the file that it was saving to was located here. I try to open the file by double-clicking it to see the saved data, but nothing comes up. What am I doing wrong?
I am trying to check that it is saving to the file properly. I am trying to verify that it is saving the text here since I am not sure where else it is saving it.
I have tried pulling it, and saving it to my desktop, but all I get is this error:
Failed to pull selection
(null)
The DDMS file explorer LOOKS like a windows file explorer, and so you think you should just click on things and drag them around and so on.
Unfortunately, it isn't. It LOOKS like that but it IS NOT that.
From the Using DDMS page we find:
To work with an emulator or device's file system:
In the Devices tab, select the emulator that you want to view the file system for.
To copy a file from the device, locate the file in the File Explorer and click the Pull file button.
To copy a file to the device, click the Push file button on the File Explorer tab.
Which is to say, you have to use the buttons to copy the file off the phone on to your local filesystem. From there you can read it using all the double clicking and dragging you are used to.
I'm guessing you viewing the file from the file explorer in the DDMS. Once you located the file there's a couple buttons on the top right corner to pull/push files from the device
Pulling the file from the device via the File Explorer is the correct way. Not sure why is it failing. Real phone or emulator?
There's another way though. There's a program called ADB in the Android SDK; it's under platform-tools. Run it with the following parameters:
adb shell cat /data/data/com.mypackage/files/textfile.txt
The package name will vary, obviously. This will print the file contents to the standard output.
EDIT:
Press Windows key+R.
Type "cmd", click OK.
Type or paste the following line:
C:\android-sdk-windows\platform-tools\adb shell cat /data/data/com.mypackage/files/textfile.txt
replacing the com.mypackage name with the name of your app's package, which I cannot possibly know. Also replace the path to the Android SDK, if needed.
Press Enter.
Watch the output.
EDIT2: by the way, are you closing the stream after writing the data? That could be the reason you could not pull the file via the File Explorer.

FileManager for NetBeans

I am developing fot Android using NetBeans. I have moved from Eclipse, where I have often used file explorer, for pushing and pulling data from and to device.
Is there in Netbeans simple window, if co, how to activate?
Thanks
To anyone still wondering, the Android SDK comes with a tool called DDMS located at
<android sdk>\tools\ddms.bat
that also has a file explorer once the program is open, located at
Device>File Explorer...
You can read more about DDMS from the android docs
If you just want to access a directory that is locally "available" (e.g. a drive in Windows, or something mounted in *Nix), then you can simply use the "Favorites" window and add that directory (or multiple directories) to that.
Then you can access the files directly in an "Explorer" like fashion.
The Favorites Window is available through "Window -> Favorites"

Putting files in emulator external storage, prior to app starting

Using the emulator, with external storage attached, I would like to emulate what happens when the application starts up and certain files are already present in the relevant directory on ext storage.
Is the external storage actually located on my machine, after enabling it in the AVD? Or should I be creating the files with some temporary, throw away code? Or should I just test on a real device?
What is best practice for this scenario?
The sdcard.img is in the avd folder (~/.android/avd). If you are using Linux or OSX you can mount it, manipulate the files inside, and unmount it.
Probably there's a program in Windows that let you do the same.
As an alternative, you can start the emulator and then manipulate the sdcard content using adb push/pull or DDMS.
The easiest way of creating the SDCard contents, would be to create the files that you need on your machine and then using the DDMS Perspective in Eclipse you can select your emulator in the Devices panel on the left, and then choose the FileExplorer tab on the right. There is a folder named sdcard which contains the SDCard contents.
By using the controlls on the right upper-side you can create folders inside the SDCard and by you can also Push files on the emulators SDCard.
As #dtmilano said, you can also achieve the same thing using Command Prompt.

Categories

Resources