代码之家  ›  专栏  ›  技术社区  ›  AhMaD AbUIeSa

从Codename one访问Android路径?

  •  1
  • AhMaD AbUIeSa  · 技术社区  · 8 年前

    FileSystemStorage.getInstance().exists(file) 它总是返回false,即使我刚刚从本机代码返回了路径

    我的代码返回如下路径:

    String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() +"/"+param+System.currentTimeMillis()+".png";

    有什么建议吗

    ----------------更新:

    final StatusClass imagePath = new StatusClass();    
    Display.getInstance().invokeAndBlock(new Runnable() {
                    public void run() {
                        Log.p("hello native");
                        imagePath.setStatusMsg(AccessNativeCamera.capturePhoto("Test"));
    
                    Log.p("goodbye native");
                    Log.p("imagePath "+imagePath);
                }
            });
    
            if(FileSystemStorage.getInstance().exists("file://" + imagePath.getStatusMsg())){
                Dialog.show("Check ","File exists", null, null);
            }
    

    当做,

    1 回复  |  直到 8 年前
        1
  •  1
  •   Shai Almog    8 年前

    这应该起作用:

    FileSystemStorage.getInstance().exists("file://" + file)
    

    Codename One中的路径总是绝对的,应该使用URL符号。