1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Klaus Calculator

Discussion in 'Android Questions' started by Shelby, Apr 9, 2019.

  1. Shelby

    Shelby Active Member Licensed User

    https://www.b4x.com/android/forum/threads/anyone-created-a-simple-calculator.16314/

    When I try to run the debug on the above calculator I find that a library is missing according to a popup message. Is there a way I can get that missing library? Also I get the following error when I run debug on the code.

    Code:
    B4A Version: 9.00
    Parsing code.    Error
    Error parsing program.
    Error description: Unknown 
    typeahlocale
    Are you missing a library reference?
    Error occurred on line: 
    55 (Main)
    Dim Locale As AHLocale
    I don't understand this error. Primarily this question is directed to Klaus but anyone's reply is appreciated. My first and only App is a calculator and I'm trying to make sense of it all.
     
  2. DonManfred

    DonManfred Expert Licensed User

    USE the forumsearch to find it. The forumsearch IS working. AHLocale
     
    Shelby likes this.
  3. Shelby

    Shelby Active Member Licensed User

    Thanks Don
     
  4. Shelby

    Shelby Active Member Licensed User

    After adding the AHLocale.jar file and the AHLocale.xml file which I can only assume act as a Library referred to above as AHLocale library, I now have the following log problems when I try to run the Klaus calculator.

    Code:
    Undeclared variable 'locale' is used before it was assigned any value.
    'That's fro line 387 ie:
    Locale.Initialize
        LanguageID = Locale.Language
        FileName = 
    "tapecalc_" & LanguageID & ".txt"


    Undeclared variable 
    'locale' is used before it was assigned any value.
    'Also from line 387


    Unknown 
    typeahlocale
    'From line 55 sub globals ie:
    Dim Locale As AHLocale
    End Sub


    Are you missing a library reference?
    Did I do the proper adding of the AHLocale files in order to satisfy the code suggesting the need for the AHLocale library?
     

    Attached Files:

    Last edited: Apr 13, 2019
  5. DonManfred

    DonManfred Expert Licensed User

    It is the project from your upload? The uploaded project does work for me. Without any error or warning.
    WhatsApp Image 2019-04-11 at 16.01.04.jpeg
     
    Shelby likes this.
  6. Shelby

    Shelby Active Member Licensed User

    O.K.,
    I guess you're suggesting I upload the code again. I'll try that. First I'll see if I can find a more recent version of the work.
    Thanks
     
  7. DonManfred

    DonManfred Expert Licensed User

    I tried your upload from post #4 from which you are talking it does not work (in #4 too).

    AHLocale library is needed and referenced in this project.
     
    Shelby likes this.
  8. Shelby

    Shelby Active Member Licensed User

    Right, I thought it was weird that I couldn't find an actual library but only those two files. I'll continue to see if I can find the AHLocale Library with searching.
    Thanks again.
     
  9. DonManfred

    DonManfred Expert Licensed User

    ?????

    The CORRECT Searchlink you can find in #2 of this thread!
    The Library is in the FIRST Searchresult.
     
    Shelby likes this.
  10. DonManfred

    DonManfred Expert Licensed User

    BTW: The link to the Library can be found in Klaus Calculator Thread too!
     
  11. Shelby

    Shelby Active Member Licensed User

    ok I'll try that again but I had problems before.
    Thanks
    Off to work now.
     
  12. klaus

    klaus Expert Licensed User

    You find the AHLocale library HERE.
    At the bottom of the first post you can download AHLocale1_16.zip.
    Unzip this file.
    You'll get two files:
    AHLocale.jar
    AHLocale.xml
    Copy these two files to your AdditionalLibraries folder.
    Have you defined an AdditionalLibraries folder in the IDE menu Tools/Configure Paths? If no, you must define one and set in the IDE.
    Then, in the IDE, in the Libraries Manager Tab check the AHLocale library.
    If your IDE is already open, right click in the Libraries Manager window and click on Refresh.
    This works !
     
    Last edited: Jun 22, 2019
    Shelby likes this.
  13. klaus

    klaus Expert Licensed User

    What exactly have you done?
    Have you tested the program from this thread : Tape calculator as it is?
    Does it work?
    Otherwise, post your project as a zip file (IDE menu File/Export As Zip), so we can see what you have done and test it.
     
    Shelby likes this.
  14. Shelby

    Shelby Active Member Licensed User

    Thanks, I'm slowly cleaning up the code. I've had to initialize the tapecalc_en file (not knowing if is it is necessary but it stopped an error. Now the logs say "Unknown member: : txt from line 77.
    i.e.
    Code:
    File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)
     
  15. klaus

    klaus Expert Licensed User

    You haven't answered my question:
    Have you tested the program from this thread : Tape calculator as it is?

    Do you have a tapecalc_en.txt file in the Files folder of the project?
    This is needed!
    It contains all the texts used in the program.
    If you want the texts in french you need the tapecalc_fr.txt file.
    If you want the texts in german you need the tapecalc_de.txt file.
    These are included in the zip file from the link above.
     
    Shelby likes this.
  16. kanati

    kanati Member Licensed User

    without looking at the project...... I can see that you are passing the filename without quotes so it things there's an object tapecale_en with a member of txt.

    Code:
    File.Copy(File.DirAssets, "tapecalc_en.txt", ProgPath, FileName)
    Again... not looking at the code but that's the obvious error there. Whether the rest of the call is correct, I have no idea.

    (But perhaps you should just nuke everything at this point and follow Klaus' suggestion and start from scratch and download the program from his link and try again without changing things.)
     
    Shelby likes this.
  17. Shelby

    Shelby Active Member Licensed User

    Thanks Kanati, that helped.
    Klaus, yes to your questions but I used the v 1-16.zip.... I'll try the above link version after work if it's different.
    Thanks
     
    Last edited: Apr 12, 2019
  18. klaus

    klaus Expert Licensed User

    I downloaded the project you posted in post #4.
    It works, like for DonManfred!
    So where is the problem, apart the AHLocale library?
     
    Last edited: Apr 12, 2019
    Shelby likes this.
  19. Shelby

    Shelby Active Member Licensed User

    unknown member txt........
    I don't get it either.
    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
        
    'SSS
        tapecalc_en.Initialize
        
    'end
        Dim FileName As String
        
    Dim i As Int

        
    If FirstTime = True Then
            
    File.MakeDir(File.DirRootExternal,"TapeCalc")
            
            
    Dim lst As List
            lst = 
    File.ListFiles(File.DirAssets)
            
    For i = 0 To lst.Size - 1
                FileName = lst.Get(i)
                
    If FileName.Length >= 15 And FileName.ToLowerCase.SubString2(09) = "tapecalc_en" And File.Exists(ProgPath, FileName) = False Then
                    
    File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)
    Off to work sorry.
     
  20. klaus

    klaus Expert Licensed User

    What exactly is your goal?
    Testing our resistance in the willing to help you?
    That's exactly what you are doing.
    When you ask for help you must read carefully the answers and suggestion you get, and also the answer.
    You were told in post #16 that your code is wrong:
    File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)
    it must be:
    File.Copy(File.DirAssets, "tapecalc_en.txt", ProgPath, FileName)
    In your last post, the error remains! You don't care about it !?
    In post #13 you were aked to post your project so we could look at it.
    You don't care about it.
    So, finally what do expect?
    How could, should we help you when you seemingly ignore all suggestions.
     
    Last edited: Apr 12, 2019
    Shelby likes this.
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