응용 프로그램이 시작될 때 데이터베이스를 생성하는 Blackberry 응용 프로그램을 구축 중입니다. 문제는 코드가 sdCard에서 제대로 작동하지만 SDCard를 제거하고 전화 메모리를 사용하려고 할 때 작동하지 않는다는 것입니다.전화 메모리에서 작동하지 않는 데이터베이스가 Blackberry의 SDCard와 잘 작동합니다.
public static String db_location="file:///SDCard/Databases/MyApp/MyDatabase.db";
public MyDatabase() {
// TODO Auto-generated constructor stub
boolean sdCardPresent = false;
String root = null;
Enumeration e = FileSystemRegistry.listRoots();
while (e.hasMoreElements())
{
root = (String)e.nextElement();
if(root.equalsIgnoreCase("sdcard/"))
{
sdCardPresent = true;
}
}
if(!sdCardPresent)
{
// If an SDCard is not available we will store our database in
// flash memory. This is not recommended for large databases.
db_location = "file:///store/home/user/Databases/MyApp/MyDatabase.db";
}
try
{
URI myURI = URI.create(db_location);
d = DatabaseFactory.create(myURI);
d.close();
}
catch (Exception e1)
{
System.out.println(e1.getMessage());
e1.printStackTrace();
}
}
이
참조 http://stackoverflow.com/questions/4447526/blackberry-sqlite-db-creation-filesystem-not-ready –