Android Question Using a file in a java lib

Discussion in 'Android Questions' started by kepler, Mar 29, 2015.

  1. kepler

    kepler Active Member Licensed User

    Hi,

    Good evening.
    I've done a Java Lib to be used in B4A as an help accessory.
    Now, my problem is this: the java lib must read a set of files. I can pass, I think, the path to the lib through B4A.
    But where do I place the files? Is it in the Files Folder inside the B4A project? Will they be added to the project when compiled?
    And, in that case, what is the correct path to provide to the lib?
    Is it:

    File.DirDefaultExternal & "/Files/"

    or just

    File.DirDefaultExternal

    or other

    ?

    I'm a little mixed up here...Sorry.

    Kind regards,

    Kepler
     
  2. DonManfred

    DonManfred Expert Licensed User

  3. kepler

    kepler Active Member Licensed User

    Hi,

    I've just made a test....
    I putted a file in the Files folder of my project, Test.txt, and compiled it.
    In the code, I placed the code:


    Code:
    Dim fname As String = File.DirDefaultExternal
       
        
    Msgbox(fname,"Info")
       
        
    If File.Exists(fname, "Test.txt"Then
        
    Msgbox("It's there!!!","Info")
        
    End If
    I don't receive the message "It's here!!!" - just the different paths. I've tryed also DirRootExternal without luck...

    Now, can someone tell me where's my file? Was it included in my project?

    Kind regards,

    Kepler
     
  4. DonManfred

    DonManfred Expert Licensed User

    The Files-Folder is your Assets-Folder so you need to check
    Code:
    Dim fname As String = File.DirAssets
      
        
    Msgbox(fname,"Info")
      
        
    If File.Exists(fname, "Test.txt"Then
        
    Msgbox("It's there!!!","Info")
        
    End If
     
  5. kepler

    kepler Active Member Licensed User

    Hi Don,

    Well, the file is there. But I can't get it - the message box tells nothing.
    Maybe the file isn't being packed and installed with my program?

    Kepler
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice