sd card storage state and detecting it being plugged in or not...

by sdphil » Sat, 16 Jan 2010 09:41:17 GMT


Sponsored Links
 i have an app that needs to be able to write to the sdcard.

so, it goes without saying that I need to be able to detect if the
sdcard is being shared or not -- simple enough.
    android.os.Environment.getExternalStorageState().equals
(android.os.Environment.MEDIA_SHARED)

if this is true, then my app does not have access to the SD card -
perfect.

I would also like to know while my app is running, if the state of the
SD card changes.  It looks like I can create a BroadcastReceiver with
an IntentFilter that traps the event.

the problem is that that the system winds up killing my process
because it has a file open on the SD card.

01-15 17:33:44.091: ERROR/vold(47): KillProcessesWithOpenFiles /sdcard
01-15 17:33:44.322: ERROR/vold(47): process com.test.test (7351) has
open file /sdcard/test/logfile.txt

how can I prevent this?

tia.



Other Threads

1. Eclipse problem: "R cannot be resolved"

I had to abandon my old distribution and installed ubuntu and then
installed eclipse and then the android SDK and ADT plugin.  All my
projects now show the  error "R cannot be resolved."  The R.java file
is simply not being generated.  I also get the error: "Error executing
aapt. Please check aapt is present at /home/bruce/android-sdk-linux/
platforms/android-1.6/tools/aapt."  Well, aapt is definitely in that
location and it is executable with the correct permissions.
I checked all the appropriate settings and everything seems correct.
I have cleaned my projects and even tried deleting the gen
subdirectory, all to no avail.   I am truly at a loss.

erisa

-- 

2. Problem with ADT plugin in Eclipse Galileo

Hello all,

I installed the ADT plugin successfully and actually worked on
tutorials. But, after having installed Google Web Tool Kit and App
Engine plugins, All related Android menus and options are gone. So, I
can no longer create any Android project and any web tool kit project
in fact. It is as if those plugins were not installed.

I checked the install software menu, and when I select the
repositories for the Google and Android plugins, it says they are
already installed. I just noticed that Eclipse no longer loads the ADT
plugin when starting, and I can't find how to have them started.

I wonder if eclipse starts any plugin at all, except the core eclipse
and java needed. What's weird is that I can't seem to find any
corresponding entries for those plugins in the plugin folder of my
eclipse galileo distribution.

Please help, as I am blocked from working on any Android or web tool
kit related project!!

Thanks,
Stphane

--~--~---------~--~----~------------~-------~--~----~

3. blackberry messenger

4. gridview using array.xml

5. Accessing Market through ACTION_VIEW Intent

6. list of best Android Dev forums/discussions

7. How to download?