2017년 8월 7일 월요일

Why did /sdcard/ turn into /sdcard/0/ with 4.2?


I've never seen this before so I'm assuming that it happened when I upgraded to 4.2: I'm fairly certain that /sdcard/ used to take me straight to my sdcard, but now when I go to that path (in CWM recovery for example) I need to go to /sdcard/0, there's also /sdcard/legacy knocking about suddenly.
What are these folders and why have they appeared?

--
That has to do with the Multi-User feature enabled with JellyBean 4.2 (not 4.1). In order to handle separate accounts, parts of the directory structure had to be changed. /sdcard/legacy e.g. always points to the currently logged-in user's sd card directory.
I currently cannot find the document where I read the details, so I cannot link any source. But with the above in mind, it's easy to guess that /sdcard/0 will most-likely be the device owners (or "first users" -- the "first user" always becomed the "device owner", only this user can create additional accounts) sd card, and so on. I will add a link to a source as soon as I can find it.
EDIT: One of the pages I got that idea from is AndroidNext1droid gives a different explanation when it comes to sd card:
With Android 4.2, Google introduced multiple users as a new feature. In order to accommodate multiple users, Google is now giving each user a their own folder for storage. If you upgraded to 4.2 from 4.1, then the 4.2 ROM will look for a certain file in /data to determine whether it needs to migrate all of your files to the new multi-user data structure. By default, 4.2 migrates all of /data/media to /data/media/0.
A problem arose though with custom recoveries. A custom recovery retains the /data/media folder during a factory reset. When you factory reset and then boot a 4.2 ROM again, the 4.2 ROM will migrate everything in /data/media again. It will migrate your files every time you factory reset. This multiple migration is what resulted in some people having their files moved to /sdcard/0 or even /sdcard/0/0 etc.
So it has in fact to do with the new Multi-User feature -- one way or the other.

--

Confused by the many locations of the virtual /sdcard/


Some devices (like my Nexus 4) don't have an external slot for an SD Card. Instead, there's a root folder called /sdcard/ that is treated the same way. But I also find other paths that all point to the same files -- there must be some kind redirects going on (I think this is called symlinks in Linux).
All these paths contain the same files:
/sdcard/
/storage/sdcard0/
/storage/emulated/0/
/storage/emulated/legacy/
Which path is the "actual" one? What about the other paths? What are they used for, why do they exist?

--
Recommended lecture: Why did /sdcard/ turn into /sdcard/0/ with 4.2?.
In short: It has to do with the multi-user functionality introduced with Jelly Bean:

⦁ /storage/emulated/0/: to my knowledge, this refers to the "emulated MMC" ("owner part"). Usually this is the internal one. The "0" stands for the user here, "0" is the first user aka device-owner. If you create additional users, this number will increment for each.

⦁ /storage/emulated/legacy/ as before, but pointing to the part of the currently working user (for the owner, this would be a symlink to /storage/emulated/0/). So this path should bring every user to his "part".

⦁ /sdcard/: According to a comment by Shywim, this is a symlink to...

  ⦁ /mnt/sdcard (Android < 4.0)
  ⦁ /storage/sdcard0 (Android 4.0+)

⦁ /storage/sdcard0/: As there's no legacy pendant here (see comments below), the "0" in this case rather identifies the device (card) itself. One could, eventually, connect a card reader with another SDCard via OTG, which then would become /storage/sdcard1 (no proof for that, just a guess -- but I'd say a good one)
Though one might get to the conclusion there should be a /storage/sdcard/legacy as well, there isn't (see comments) -- which completely makes sense with my assumption of the numbers here are not related to the user, but rather to possible multiple cards: "0" would always be the one in the card-slot of the device, so no need for a "legacy symlink" here.

--
Yea a bit confusing but these are alternate paths for the memory layout
/mnt/sdcard0/ (Internal Virtual SD Card)
and Izzy your correct if more devices are connected, but the naming could be different depending on device.
ex. /mnt/sdcard1/ (Physical SD Card in SD slot)
but other devices such as a Usb flash drive connect with an adapter could be called
/mnt/media_rw/usbdisk (android kitkat 4.4 and above?) or /mnt/usbdisk (jellybean 4.1 - 4.2)

--

Time pause and call edge on a method question. please


Please SEARCH in this forum before posting your question.   There's a good chance your question has already been asked.

- Are you using MIT App Inventor Classic, MIT App Inventor 2, or something else (what?)
Using: MIT App Inventor 2

- What OS are you using? (e.g, MacOS 1.8, Windows 8, ...)
Windows 8

- What browser are you using (e.g, Chrome version 30, Firefox 24, IE 8, ...)
Chrome.
Also provide as much information as you can, such as screenshots and instructions that will let others duplicate the issue.

Hi all, This App is the best thing that happened on the Web, I have only been using it for a week, i use to write Quick basic, that tell you how long ago i last wrote a program, I like programming, and would appreciate you help.

1. Can you help me add a pause time between the moving each ball.
2. how can i get the the edge in the other Method

or do i have to approach it in a different way, would really appreciate your support.

Please see attached file 



--
The 'other' socket needs a component block for a ball or ImageSprite. 
You can find those by selecting one of your ball instances or ImageSprite instances from the list on the left in the blocks editor.
Then scroll to the bottom of that list and the last block will be the component block with just the name of the component instance on it.

--
Thank you for the reply, but i need the balls to detect the edge of the screen, 

--
Thank you for the reply, but i need the balls to detect the edge of the screen, 
use the Ball.EdgeReached event. 

--

search results for Quick question about file component


file names are case sensitive. in your case, you have to use //Book1.csv. note the capital B. Taifun.
To answer Taifun's question about storing 301.jpg and accessing it with the " Image" component: (as opposed to what the "Filecomponent can do).
Then scroll to the bottom of that list and the last block will be the component block with just the name of the component instance on it. ---. Scott ... Please SEARCH in this forum before posting your question. ... Please see attached file