黑莓:没能获得位置SD卡/介质卡作为fileSystemRoot? [英] Blackberry: Not able to get locations SDCard/Media Card as fileSystemRoot?

查看:123
本文介绍了黑莓:没能获得位置SD卡/介质卡作为fileSystemRoot?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要openOrCreate在SD卡/介质卡数据库。当我运行设备(黑莓8900)的应用,我发现只有一个根即系统/,并在模拟器(9500)运行的应用程序,我发现三个根如在code评论。我在收到错误;

I want to openOrCreate database in SDcard / Media Card. When i run the application in device (BlackBerry Curve 8900), i find only one root i.e "system/" and running application in simulator (9500), i find three roots as shown in comment in code. I am getting error at;

  _db = DatabaseFactory.openOrCreate(_uri); 
  (error: Method "toString" with signature "()Ljava/lang/String;" is not applicable on this object)

,我无法理解这是什么错误的。
这里是code。

And i am not able to understand what is this error about. Here is the code.

public void getValues() throws Exception
{

    boolean sdCardPresent = false;
    String root = null;
    Enumeration e = FileSystemRegistry.listRoots();
    while (e.hasMoreElements())
    {
        root = (String)e.nextElement();
        System.out.println("Value of root::" +root); // value of root = "system/" when run in device and
                                                     // value of root = "store/" "SDCard/" "system/" when run in simulator 
        if(root.equalsIgnoreCase("system/"))
        {
            sdCardPresent = true;
        }     
    }         
    System.out.println("--------------------getValues()----------------------------------");
    URI _uri = URI.create(Global.DB_PATH + Global.DB_Main);
    System.out.println("Valud of uri::" +_uri);
    _db = DatabaseFactory.openOrCreate(_uri); //getting error here. 
    System.out.println("Valud of _db::" +_db);
    _db.close();

我想这三个路径,得到输出/存储(当模拟器中运行),但误差在设备中使用/店其余2 paths.Even正显示出同样的错误。

I tried these three paths, getting output with "/store"(when run in simulator) but error with rest two paths.Even using "/store" in device is showing the same error.

Global.DB_PATH = "/MediaCard/databases/";
Global.DB_PATH = "/SDCard/databases/";
Global.DB_PATH = "/store/databases/";

有什么办法如何让SD卡/介质卡作为根,这样我可以在那里复制的数据库?

Is there any way how to get SDCard/Media Card as root so that i can copy the database in there?

推荐答案

我的猜测是,当你是一个真正的设备上运行你的应用程序,你有USB电缆将设备插入。如果是这样的情况下,尽量拔掉数据线,并重新运行应用程序。您可以使用 Dialog.inform()来快速检查你所得到的根这个时候。

My guess is when you are running your app on a real device you have USB cable plugged in to the device. If this is the case, try to unplug the cable and rerun the app. You may use Dialog.inform() to quickly check what roots you get this time.

这篇关于黑莓:没能获得位置SD卡/介质卡作为fileSystemRoot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆