B4A Library ICOSWorldForecast 3.50

View attachment 14755 View attachment 14754 View attachment 16846 Hi guys, ICOSWorldForecast is here.


It's a pleasure to introduce the new library of weather forecast.

The zip include:

The library, and the demo

INSTALLATION:

Copy the Library in your Basic For Android Library.

Copy the folder weathericon is located in files in the demo. In your one.


RENAME:
ICOSWorldForecast2.71.part1.zip and ICOSWorldForecast2.71.part2.zip

TO:
ICOSWorldForecast2.71.part1.rar and ICOSWorldForecast2.71.part1.rar

In this version I add WeatherUrl and 2 more days forecast.

You can use your own icons, instead of my icons.

For this new version 2.71 you need the new key.

You must register to obtain the new key, otherwise you will get error.

Use the address below to register.

World Weather Online - Welcome to the World Weather Online Developer Network!

don't forget to replace the ApiKey="XXXXXXXXXXXXXX" with your private key

This demos, I made with my galaxy tab 7 600x1024

any question or bugs please report to me.

big Thx to warwound for is fantastic auto-generated reference.


ICOSWorldForecast
Author:
Giuseppe Salvi
Version: 2.81
  • ICOSWorldForecast
    Methods:
    • FCDate (index As Int) As String
      Return Date for which the weather is forecasted
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCDate(0)
    • FCIcon (index As Int) As Bitmap
      Return Weather symbol image
      example:
      Dim a As ICOSWorldForecast
      Image1.SetBackgroundImage=a.FCWeatherIcon(0)
    • FCIconUrl (index As Int) As String
      Return URLIcon For Forecast Condition
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCIconUrl(0)
    • FCPrecipitationMM (index As Int) As String
      Return Precipitation amount in millimeter
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCPrecipitationMM(0)
    • FCTempMaxCelsius (index As Int) As String
      Return Day and night max temperature in Celcius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMaxCelsius(0)
    • FCTempMaxFahrenheit (index As Int) As String
      Return Day and night max temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMaxFahrenheit(0)
    • FCTempMinCelsius (index As Int) As String
      Return Day and night min temperature in Celcius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMinCelsius(0)
    • FCTempMinFahrenheit (index As Int) As String
      Return Day and night max temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMinFahrenheit(0)
    • FCWeatherCode (index As Int) As String
      Return Weather Code
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWeatherCode(0)
    • FCWeatherDesc (index As Int) As String
      Return Weather description
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWeatherDesc(0)
    • FCWinddir16Point (index As Int) As String
      Return 16-Point compass wind direction
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddir16Point(0)
    • FCWinddirDegree (index As Int) As String
      Return Wind direction in degree
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddirDegree(0)
    • FCWinddirection (index As Int) As String
      Return Compass Wind direction
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddirection(0)
    • FCWindspeedKmph (index As Int) As String
      Return Wind speed in kilometer per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWindspeedKmph(0)
    • FCWindspeedMiles (index As Int) As String
      Return Wind speed in Miles per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWindspeedMiles(0)
    • FindLatAndLong As String
      Retrieve accurate latitude and longitude from GPS or network services
    • FindLocation As String
      Retrieve accurate location from GPS or network services
    • Full7DayName (day As Int) As String
      Return Full name of the day ( Monday )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Full7DayName(0) ' 0 = today - 1 = tomorrow etc etc
    • GetList (mCity As String) As ArrayList
      Set the City Name you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      Dim l As List
      Dim lv1 As ListView
      l = a.GetList("Los Angeles")
      For n = 0 To l.Size-1
      lv1.AddSingleLine(l.Get(n))
      Next
      Sub lv1_ItemClick (Position As Int, Value As Object)ics.CityName = lv1.GetItem(Position)
      lv1.Clear
      End Sub
    • Initialize (EventName As String)
      Initilize the object
    • Short7DayName (day As Int) As String
      Return Short name of the day ( Mon )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Short7DayName(0) ' 0 = today - 1 = tomorrow etc etc
    • StringFormat (format As String, object As Object, object1 As Object) As String
      Return Formatted String
      example:
      Label1.Text=StringFormat("Lat: %1$s - Long: %2$s ",Latitude,Longitude)
    • isWiFiConnected As Boolean
      Check if WiFi is Connected
    Permissions:
    • android.permission.ACCESS_ASSISTED_GPS
    • android.permission.ACCESS_COARSE_LOCATION
    • android.permission.ACCESS_FINE_LOCATION
    • android.permission.ACCESS_GPS
    • android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.ACCESS_WIFI_STATE
    • android.permission.CONTROL_LOCATION_UPDATES
    • android.permission.INTERNET
    Properties:
    • ApiKey As String [write only]
      Set your personal ApiKey
      example:
      Dim a As ICOSWorldForecast
      a.ApiKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    • AreaName As String [read only]
      Return Name of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.AreaName
    • CCCloudCover As String [read only]
      Return Cloud Cover in %
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCCloudCover
    • CCHumidity As String [read only]
      Return Humidity in %
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCHumidity
    • CCIcon As Bitmap [read only]
      Return Weather symbol image
      example:
      Dim a As ICOSWorldForecast
      Image1.SetBackgroundImage=a.CCWeatherIcon
    • CCIconUrl As String [read only]
      Return URLIcon For Current Condition
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCIconUrl
    • CCLocalObsDateTime As String [read only]
      Return Local Observation date and time
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCLocalObsDateTime
    • CCObservationTime As String [read only]
      Return Observation time (UTC)
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCObservationTime
    • CCPrecipitationMM As String [read only]
      Return Precipitation Amount in Millimeter
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.PrecipitationMM
    • CCPressure As String [read only]
      Return Atmospheric pressure in Milibars
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCPressure
    • CCTempCelsius As String [read only]
      Return Temperature in Celsius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCTempCelsius
    • CCTempFahrenheit As String [read only]
      Return Temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCTempFahrenheit
    • CCVisibility As String [read only]
      Return Visibility kilometers per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCVisibility
    • CCWeatherCode As String [read only]
      Return Weather Code
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWeatherCode
    • CCWeatherDescription As String [read only]
      Return Weather Description
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWeatherDescription
    • CCWinddir16Point As String [read only]
      Return 16-Point wind direction compass
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWinddir16Point
    • CCWinddirDegree As String [read only]
      Return Wind direction in degree
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWinddirDegree
    • CCWindspeedKmph As String [read only]
      Return Wind speed in kilometer per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWindspeedKmph
    • CCWindspeedMiles As String [read only]
      Return Wind speed in Miles per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWindspeedMiles
    • CityName As String [write only]
      Set City you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      a.CityName="New York"
    • Country As String [read only]
      Return Name of the Country
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Country
    • CurrentDate As String [read only]
      Return Current Day,Month,Year ( Friday, 28 September, 2012 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CurrentDate
    • CurrentTime As String [read only]
      Return Current time ( 02.09 PM )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CurrentTime
    • DstOffset As String [read only]
      Return DstOffset = ( GMT +2 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.DstOffset
    • GmtOffset As String [read only]
      Return GmtOffset = ( GMT +1 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.GmtOffset
    • LatAndLong As String [write only]
      Set Lat and Long you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      a.LatAndLong="40.714,-74.006"
    • Latitude As Object [read only]
      Return Latitude of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Latitude
    • Longitude As Object [read only]
      Return Longitude of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Longitude
    • Population As String [read only]
      Return Population of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Population
    • Region As String [read only]
      Return Name of the Region
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Region
    • Sunrise As String [read only]
      Return Sunrise = 06:04
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Sunrise
    • Sunset As String [read only]
      Return Sunset = 19:36
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Sunset
    • TimeZoneID As String [read only]
      Return TimeZoneID = Europe/Rome
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.TimeZoneID
    • Version As Double [read only]
      Return the version of this library
    • WeatherUrl As String [read only]
      Return url of the city [ http://www.worldweatheronline.com/London-weather/City-of-London-Greater-London/GB.aspx ]
      example:
      Dim Webview1 As Webview
      Webview1.LoadUrl(a.WeatherUrl)
 

Attachments

  • ICOSWorldForecast_DEMO.part1.zip
    293 KB · Views: 983
  • ICOSWorldForecast_DEMO.part2.zip
    167.1 KB · Views: 787
  • Main.png
    Main.png
    86.8 KB · Views: 936
  • Widget.jpg
    Widget.jpg
    81.8 KB · Views: 922
  • ICOSWorldForecast.png
    ICOSWorldForecast.png
    156.3 KB · Views: 983
  • ICOSWorldForecastFree_v3.50_lib_fix.zip
    53.9 KB · Views: 532
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, first at all I'm sorry I forgot to give U back the translation, second I'm fixing all library and specially this one. Also the Premium I'm fixing this issue thank you to remember me the issue.

No worries Giuseppe, we are all busy sometime, me too.
That sounds interesting if you can fix that.
But take your time, already you haven't computer :(

Best regards Giuseppe, and hold on.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Laurent and all, I found the issue and fixed it (I ope)
i used my geo username in the library that's why we got the issue below.

the hourly limit of 2000 credits for lonleystar has been exceeded.
Please throttle your requests or use the commercial service.
this was the issue.

Anyway
I add:

SearchCity

B4X:
Sub Globals
    Dim ed0 As EditText
    Dim Search As ICOSForecastGetList
    Dim panel1 As Panel
End Sub

Sub b1_click
    Dim s As String
    Search.Initialize("Search")


    If ed0.Text.Length > 0 Then
        Try
          s=Search.SearchCity(ed0.Text,"ICOSWorld Forecast Demo v3.00",True)
            If s.Length > 0 Then
          a.CityName=s
          StartActivity(Forecast)
          End If
        Catch
          ToastMessageShow(" Probably server error!! ",True)
        End Try
    End If
End Sub
GeoUserName = Your User Name.

ho to get own username.

http://www.geonames.org/ click on login and create an account. Got the username give it to GeoUserName = Your User Name


or

B4X:
Try

  lab1.text="SunRise / Set : "& _
  forecast.Sunrise&" / "& _
  forecast.Sunset
 
  lab2.text="GMT: - DST: - TZID: "& _
  forecast.GmtOffset&" - "& _
  forecast.DstOffset&" - "& _
  forecast.TimeZoneID

Catch

  lab1.text="SunRise / Set :  N/A"
  lab2.text="GMT: - DST: - TZID: N/A"

End Try



or don't use the commons below till i finde something else.

Sunrise,Sunset,GmtOffset,DstOffset,TimeZoneID



P.S
I use the code above.

any bug please report to me.


pic2.jpg
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent and all, I found the issue and fixed it (I ope)
i used my geo username in the library that's why we got the issue below.

the hourly limit of 2000 credits for lonleystar has been exceeded.
Please throttle your requests or use the commercial service.
this was the issue.

Anyway
I add:
SearchCity

.../...

Hi Giuseppe,

Wowwww, you too you're victim of your success :)
Emmmm, hope that it's not my widget who do that, sorry if it's :confused:

Tell me please if we fix the account with our own geo username, could we have the return of code error from the library, or you're not ready for that yet ?
I ask because i fear i have the same issue, and the users make me :mad: sometime.
Thanks for your response.

And congrats for this quick update, who seems working fine. :)

Best regards, Laurent.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, for me it's not a problem, to avoid this issue I think it's better to have your own username.

You've to think the hourly limit is 2000 credits.

I think i don't make me enough understandable, i mean is it possible that we could have soon the error codes returned by the library for manage errors.
Because it's possible we reach also the limit of 2.000 with our application.
If we have at least the latest error returned we can test it and do something.

And in more with my widget i reach also the limit of the World Weather Online website.

I know it's not an easy thing to do but that would be very useful.
Thank you.
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, for me it's not a problem, to avoid this issue I think it's better to have your own username.

You've to think the hourly limit is 2000 credits.

Hi Giuseppe,

It seems i have again a problem with the forecast data.
I have try to do a new account on the WorldWeatherOnline website, for be sure that the limit isn't happened.
Also i use a new account on the Geonames API website and i have always the same error code.
The error code is about the size or area see below :
B4X:
This is the part of the code, like the example does.
    Try
       Log("This day Full5DayName of library is : " & Main.a.Full5DayName(1) & CRLF & _
         "this day date is : " & Main.a.FCDate(0))    '<- i get the first error here because of the index 1 of full5dayname, the index 0 work.
       l1.Text=Main.a.Full5DayName(1)&CRLF&Main.a.FCDate(1)
       l3.Text=Main.a.Full5DayName(2)&CRLF&Main.a.FCDate(2)
       l5.Text=Main.a.Full5DayName(3)&CRLF&Main.a.FCDate(3)
       l7.Text=Main.a.Full5DayName(4)&CRLF&Main.a.FCDate(4)
       Log("Library give the Full7DayName normally")
     Catch
       'That's a little "Sub" that i have wrote when the forecast data don't support correctly the 7 days.
       ' it wouldn't needed now but i let the code like that.
       myFull5DayName(Main.a.FCDate(0))
       Log("WeatherDays lenght is " & WeatherDays.Length)
       Log("WeatherDays " & WeatherDays(0) & _
               " " & WeatherDays(1) & _
               " " & WeatherDays(2) & _
               " " & WeatherDays(3) & _
               " " & WeatherDays(4))
       ' Sorry I don't logged the error here, but at last there are 3.
       Log("This day date is : " & Main.a.FCDate(0))
       Try
         'And that the second error i get
         l1.Text=WeatherDays(1)&CRLF&Main.a.FCDate(1)   '<- the index 1 give the second error.
         l3.Text=WeatherDays(2)&CRLF&Main.a.FCDate(2)
         l5.Text=WeatherDays(3)&CRLF&Main.a.FCDate(3)
         l7.Text=WeatherDays(4)&CRLF&Main.a.FCDate(4)
       Catch
         ' The first error logged
         Log("The latest error is : " & LastException.Message)
       End Try
     End Try
   
     Try
       l2.Text=Main.a.FCTempMaxCelsius(1)&"° / "&Main.a.FCTempMinCelsius(1)&"°"  '<- the index 1 give the third error.
       l4.Text=Main.a.FCTempMaxCelsius(2)&"° / "&Main.a.FCTempMinCelsius(2)&"°"
       l6.Text=Main.a.FCTempMaxCelsius(3)&"° / "&Main.a.FCTempMinCelsius(3)&"°"
       l8.Text=Main.a.FCTempMaxCelsius(4)&"° / "&Main.a.FCTempMinCelsius(4)&"°"
       l10.Text=Main.a.FCTempMaxCelsius(5)&"° / "&Main.a.FCTempMinCelsius(5)&"°"
       l12.Text=Main.a.FCTempMaxCelsius(6)&"° / "&Main.a.FCTempMinCelsius(6)&"°"
     Catch
        ' The second error logged
     Log("The latest error is : " & LastException.Message)
     End Try

And the Log :
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (forecast) Create, isFirst = true **
(Forecast, 54) FullScreen or IncludeTitle properties in layout file do not match the activity attributes settings. (warning #1004)
This day Full5DayName of library is : Tuesday
this day date is : May 26
WeatherDays lenght is 5
WeatherDays Monday Tuesday Wednesday Thursday Friday
This day date is : May 26
The latest error is : java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
The latest error is : java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
** Activity (forecast) Resume **

An idea for why that happens ?
Thank you.

Regards, Laurent.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Laurent, the problem is not world weather online is the (api.geoname.org), but i got the solution just testing before to update to the forum till tomorrow will be updated.


P.S.
the premium version depend on from free version and if it is not 100% functionality i cant post also the premium.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Laurent and All, ICOSWorldForecastFree is update to 3.10 what's new:

fix the issue from Geo provider fix issue when Developer is Over Rate from World Weather Online.

Add:

RequestConnectServer Returns an error from the url page
RequestConnectServer2 Returns an error produced by the server


If You have more than one Apikey, below first tip.

B4X:
   Dim request As Int
   Dim city As String = "Melbourne"
   If a.isWiFiConnected = True Then

    request = a.RequestConnectServer2(city)

    If request > 0 Then 

    a.apiKey="XXXXXXXXXXXXXXXXXXXXXX"  - alternative key

    End If

    a.CityName = city

    StartActivity(Forecast)

   End If

End If

second tip:

B4X:
   Dim request As Int
   Dim city As String = "Melbourne"
   If a.isWiFiConnected = True Then

    request = a.RequestConnectServer(city)

    If request = 0 Then 

    a.CityName = city

    StartActivity(Forecast)

    Else

    ToastMessageShow(a.GetResponseCode(request),True)

    return

    End If

   End If
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent and All, ICOSWorldForecastFree is update to 3.10 what's new:

fix the issue from Geo provider fix issue when Developer is Over Rate from World Weather Online.

Add:

RequestConnectServer Returns an error from the url page
RequestConnectServer2 Returns an error produced by the server

Hi Giuseppe,

I have tried it today, it's ok the function, the both, work fine, i haven't seen already an error today, it's maybe earlier for a lot of my customers lollll.
But now we have a small problem, all the forecast data don't work they return an error, the size of index is only 1.
If you can see that, for i could do the update of my program, thank you very much.

Best regards, Laurent.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Laurent, I use this way to get the right index.



B4X:
Sub Process_Globals
   Dim index As Int
End Sub



Sub img0_Click
   index = 0
   StartActivity(NextDay)
End Sub

Sub img1_Click
   index = 1
   StartActivity(NextDay)
End Sub

Sub img2_Click
   index = 2
   StartActivity(NextDay)
End Sub

Sub img3_Click
   index = 3
   StartActivity(NextDay)
End Sub

Sub img4_Click
   index = 4
   StartActivity(NextDay)
End Sub


P.S

If I understood wrong please correct me with an example.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, I use this way to get the right index.

B4X:
Sub Process_Globals
   Dim index As Int
End Sub

Sub img0_Click
   index = 0
   StartActivity(NextDay)
End Sub
etc...

P.S
If I understood wrong please correct me with an example.

Sorry Giuseppe, i don't well explain myself, it's when i try to show the forecast data.
And also the library don't find the icons now, even if i have all in good place

It's better with an example see the attached zip and below the errors in the log :

LogCat connected to: 192.168.56.101:5555
--------- beginning of /dev/log/main

--------- beginning of /dev/log/system
.../...
** Activity (forecast) Create, isFirst = true **
The latest error is : java.io.FileNotFoundException: weathericon/wsymbol_0008_clear_sky_night.png
The latest error is : java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
The latest error is : java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
The latest error is : java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
** Activity (forecast) Resume **
** Activity (forecast) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
 

Attachments

  • ICOSWorldForecastDemov3.1lib.zip
    33.1 KB · Views: 217

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, where are the resources --> (AResource1.GetApplicationString("Code"&CCCode))

Sorry, but no worries it's not related with the errors, the errors is on the line 105 and those who follow.
I only use CCCode in resource for separating clear/sunny and some other parts who're not related . Below the good file of resource.

For the icons it seems that is the virutal device who don't find it in rapid debug mode in the legacy debug mode the icon appears. But i have always the error with the forecast data, B4A continue to say me the index is only 1. Indeed if i use the index 0 it's ok but each time i try the forecast and not the current day i have an error.

If you want see better what's happen, you must comment all lines "Try, Catch, Log(xxxx, LastException.Message) and End Try" in the code and you can see B4A's errors in the log with the lines.

I must use this way because on my virtual device it closes the program when an error appears in the library. Then i can't debug or see what happen.
I can't loose my time for know why it does that in this moment i will see that later.

Thank you for try to see what happen Giuseppe, that's nice from you.

Regards.
 

Attachments

  • strings.zip
    957 bytes · Views: 193
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
If Erel see this, can he confirm us that it's possible to test a program who use something in a sub folder of Assets directory in the rapid debug mode ?
Thanks for that, otherwise i will try more later, but that sounds weird.

Regards.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Laurent, i try to understand the code u send to me.

1) all strings return null
B4X:
Dim CCCode As Int
Dim tmpDescr As String

CCCode =  Main.a.CCWeatherCode --> this return a string not int

tmpDescr = AResource1.GetApplicationString("Code"&CCCode) --> return null

tmpDescr = Main.a.CCWeatherCode -->  return the Weather code

end below i get error too.

'If tmpDescr.Contains("/") Then
     '   Dim tmpHours As Int
     '   Dim tmpStrHours1, tmpStrHours2 As String
     '   tmpStrHours1 = Main.a.CurrentTime
     '   tmpStrHours2 = tmpStrHours1.SubString2(0,tmpStrHours1.IndexOf("."))
     '   tmpHours = tmpStrHours2
     '   If tmpHours < 7 OR tmpHours > 21 Then
     '     lb4.Text=tmpDescr.SubString2(0,tmpDescr.IndexOf("/"))
     '   Else
     '     lb4.Text=tmpDescr.SubString(tmpDescr.IndexOf("/")+1)
     '   End If
     'Else
     '   lb4.Text=tmpDescr
     'End If

in sub loadsecondare as well

Dim CCCode As Int
Dim tmpDescr As String
CCCode = Main.a.FCWeatherCode(index) --> return null


all commands return a string


can u send your email so i'll send to u my demo project already compiled
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, i try to understand the code u send to me.

1) all strings return null
B4X:
Dim CCCode As Int
Dim tmpDescr As String

CCCode =  Main.a.CCWeatherCode --> this return a string not int.
'Yes, but no worries it's all time an integer who is returned even if it's stocked in  a string.
'All program languages can translate it like an integer. In more we can declare it as a string
'if we want, because it's concatenated for be compared with a string after.

tmpDescr = AResource1.GetApplicationString("Code"&CCCode) --> return null.
'Have you put the latest "strings.xml" file in the resources folder ? As i have told you
'yesterday since i do tests with the different updates of library, i have does a mistake with
'the saved files. The first "strings.xml" hasn't the WWOnline's codes inside, only in the file
'inside the French folder the codes are.

tmpDescr = Main.a.CCWeatherCode -->  return the Weather code.
'I don't see that in  the code, you means CCCode = Main.a.CCWeatherCode ?
'If it is, that's normal even i use it like an int i take the weather code for show
'"Clear" or "Sunny".

end below i get error too.
'Of course because, i guess, the file "srtings.xml" doesn't content the WWO's codes lines
'and the test crash because the returned string is empty. BA4 return an error if you try
'to extract a part of an empty string.

'If tmpDescr.Contains("/") Then
     '   Dim tmpHours As Int
     '   Dim tmpStrHours1, tmpStrHours2 As String
     '   tmpStrHours1 = Main.a.CurrentTime
     '   tmpStrHours2 = tmpStrHours1.SubString2(0,tmpStrHours1.IndexOf("."))
     '   tmpHours = tmpStrHours2
     '   If tmpHours < 7 OR tmpHours > 21 Then
     '     lb4.Text=tmpDescr.SubString2(0,tmpDescr.IndexOf("/"))
     '   Else
     '     lb4.Text=tmpDescr.SubString(tmpDescr.IndexOf("/")+1)
     '   End If
     'Else
     '   lb4.Text=tmpDescr
     'End If

You can comment all of this part of code, the unique reason of that it's to show "Clear" in night (reason of the test between 7 and 21) and "Sunny" in day :)
No worries i give you an email for send me your example
, the best way for we don't became made ;)

in sub loadsecondare as well

Dim CCCode As Int
Dim tmpDescr As String
CCCode = Main.a.FCWeatherCode(index) --> return null
You haven't errors with the forecast data ???? Me long time ago i have got an error if i try to read the forecast data , B4A say me the index size is 1. I was never arrival there during test :).

all commands return a string

can u send your email so i'll send to u my demo project already compiled


Hi Giuseppe,

Ok i try to respond and make you understanding the example i do, my comments are like commented lines in "CODE" parts and in blue in the quoted text above.
Generally i treat the things like a string because with the library for the resources it's usually stocked like string.

You can send me an email on lolizprod@gmail.com, i think it's better you send me your example, because this one is extract from my widget.
It's why it content some code different like the example usually attached to your library.

Thank you very much for your interest and the help :).

Best regards, Laurent.
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, I sent to U an Email with my demo attached.

For Your demo now i get only index error and FCIcon(1) 2 3 4 does not display nothing i really dont understand why.

Hi Giuseppe,

Thank you for all, i have respond you by email.

As i told you in the email i think it's because i still on B4A 3.5, i don't see anything other possible.
Edit : Capped, we haven't the forecast data in my example because i don't initialize the "ICOSWetaher.NumOfDays=5", grrrrrrrr :mad:.
Sorry for this mistake Giuseppe, forgive me i will bang my head many time for that. I keep in mind the old version where we don't need to initialize this.


A good indication, in rapid debug the virtual device continue to don't find the sub folder of the asset directory.
I will ask Erel for this two things when i have a bit time to do it.


Thank you for your help Giuseppe, you're always also cool :)
And sorry for the part of your time that i have taken :confused:

Regards, Laurent.
 
Last edited:
Top