【问题标题】:Database not working in phone memory works fine with SDCard in Blackberry数据库在手机内存中无法正常工作与黑莓中的 SDCard
【发布时间】:2011-03-29 21:53:32
【问题描述】:

我正在构建一个 Blackberry 应用程序,在该应用程序启动时创建一个数据库。问题是代码在 sdCard 上运行良好,但是当我删除 SDCard 并尝试使用 Phone Memory 时,它不起作用。 这是我用来创建数据库的代码:

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();
     }


    }

请推荐

【问题讨论】:

标签: blackberry blackberry-simulator


【解决方案1】:

BlackBerry 仅在某些型号上支持将 SQLite 数据库保存在 eMMC 内存 (/store) 中。

例如,BlackBerry Curve 8520(您似乎拥有)不支持将 SQLite 数据库保存在 /store 中(仅在 /SDCard 中)。

【讨论】:

  • 编码中有没有prblm.. ?...是的,我有8520曲线
猜你喜欢
  • 1970-01-01
  • 2018-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-27
相关资源
最近更新 更多