Code sample: Retrieving a list of mounted roots
import java.util.Enumeration.*;
import javax.microedition.io.file.FileSystemRegistry,*;
import net.rim.device.api.ui.component.LabelField.*;
import net.rim.device.api.ui.container.MainScreen.*;
import net.rim.device.api.ui.UiApplication.*;
public class ListMountedRoots extends UiApplication
{
public static void main(String[] args)
{
ListMountedRoots app = new ListMountedRoots();
app.enterEventDispatcher();
}
public ListMountedRoots()
{
pushScreen(new HomeScreen());
}
}
class HomeScreen extends MainScreen
{
public HomeScreen() {
StringBuffer msg = new StringBuffer( “The mounted roots are:\n”);
Enumeration e = FileSystemRegistry.listRoots();
while (e.hasMoreElements()) {
msg.append( e.nextElement() );
msg.append( ‘\n’ );
}
add(new LabelField(msg));
}
}
Next topic: Storing data in
SQLite databases