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. Question on getting talkback to work in teh emulator

I have just started looking at doing some Android development.  However as 
a visually-impaired developer I would really like to get talkback or some 
screenreader to work in the emulator so I can test the code I write and 
hopefully get feedback.  Is there a way to do this?  I have read 
everything I can find on the web but have found no mention of how to do 
it.


Thanks
Tom

--

2. Catch the results from QSB

Hi, I'm using a QSB in my app, i try to catch suggestions provided by
global search. When the user click on the search button i want to get
the result of the search and launch a custom method for this. I try to
override the method onSearchRequested() but it does't work. Any idea
for this?

-- 

3. HorizontalScrollView in a ListView

4. gstreamer on android

5. HelloWorld.... now what?

6. Directories and Files on External Storageare invisible

7. RE : Host not resolved issue