views:

148

answers:

1

I have a program that uses the SD card, so I want to be informed if the state of the card changes by registering a listener if possible. I'm aware of the Environment class and its methods, but I don't really want to be constantly polling the state. I'd rather not have my program force close when running cause someone mounted the sd card to their computer.

+4  A: 

Create a BroadcastReceiver for ACTION_MEDIA_MOUNTED and related intents.

Mirko Nasato