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: 982
  • ICOSWorldForecast_DEMO.part2.zip
    167.1 KB · Views: 786
  • Main.png
    Main.png
    86.8 KB · Views: 935
  • Widget.jpg
    Widget.jpg
    81.8 KB · Views: 921
  • ICOSWorldForecast.png
    ICOSWorldForecast.png
    156.3 KB · Views: 982
  • ICOSWorldForecastFree_v3.50_lib_fix.zip
    53.9 KB · Views: 531
Last edited:

fanfalveto

Active Member
Licensed User
Longtime User
i think from then server change the code and then the library don´t work fine,lonelystar do a great work but the problems must continue ever
 

fanfalveto

Active Member
Licensed User
Longtime User
now all is ok,but few days ago don´t works fine images of tomorrow for example,and name of days.
but now works fine.
and thank you very much for your great work
 

metrick

Active Member
Licensed User
Longtime User
Got error on img3.Bitmap = wwo.FCIcon(1) here are are the message.
"An error has occurred in sub:forecast_weather(Java line:437) Java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 Continue?"
Device Samsung Galaxy Tab 2, 7" model.
 

sdb

Member
Licensed User
Longtime User
Got error on img3.Bitmap = wwo.FCIcon(1) here are are the message.
"An error has occurred in sub:forecast_weather(Java line:437) Java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 Continue?"
Device Samsung Galaxy Tab 2, 7" model.

I am getting a similar error as above starting last night. It is either an error from the provider which I am not handling properly or they changed something. My program has been working fine for several months and I am using the latest version of the library.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi guys , here the fixed library.

Hi metrick u got this error why the World weather online changed again from 7 to 5 days.

I added 2 new commands:



WeaterByLocalIpAddress
LocalIpAddress


U can use

WeaterByLocalIpAddress = LocalIpAddress

or

WeaterByLocalIpAddress = "146.185.31.213"
 

Laurent95

Active Member
Licensed User
Longtime User
Hello Giuseppe,
Thank you for all, indeed all works again.
But that's a shame that they have never warned us about any change.
For now that not give us the envy to have a premium account, wait and see.

Regards.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent thx U and others to report the error.
You are right their change without notice.
The problem now i make a lot of contract per day mens i come back home later evening.

But as i promise the premium come soon.
please to every body have patience.

Hi Giuseppe,
Thank you for this !!!!!!!
You can count on us, we stay with you for all, no worries.
Just it's a shame you pass so many time on this, only because they change without warning us.
I really respect your work, who is very awesome, but i hate people who don't take care about their equals in world.
Like these new waves who consider that it's not a problem that someone don't feel good.
you can count of us, i believe (please, all people do it, and say it !!!!!).
Sorry for the most of time that they ask to you, for me you stay as a very good mentor.
Thank you to help us :=)

And please, hold on, i am soon to be released and i still believe in human race :)

P.S : without abusing can i ask you to correct me for German translation ?
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, thx you and every body to understand me, for the german translation of cours i´ll be happy.
Hi Giuseppe, thank you i will send you the string's files, English and German, this week end :)
And of course if you need the inverse in French that would be a pleasure.

Hi Giuseppe, i will wait that you have more time for take a look on my german translation, no worries. I wish you a good WE.
 
Last edited:

javiers

Active Member
Licensed User
Longtime User
Hello, when I get coordinates of a point on the sea (eg coordinates are: 44.99511917343001 / 44.99511917343001 ) I get the following error.
Is there any way to solve it? Thanks.

B4X:
a.LatAndLong = CoorXY.Latitude & "," & CoorXY.Longitude
java.lang.NullPointerException: Error Parsing Weather!!!
  at it.giuseppe.salvi.icos.library.weather.forecast.provider.ICOSForecastWrapper.getWeather(ICOSForecastWrapper.java:75)
  at it.giuseppe.salvi.icos.library.weather.ICOSWorldForecastWrapper.setLatAndLong(ICOSWorldForecastWrapper.java:320)
  at b4a.example.main._weather(main.java:5670)
  at b4a.example.main._mapfragment1_click(main.java:3595)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
  at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
  at anywheresoftware.b4a.objects.MapFragmentWrapper$2.onMapClick(MapFragmentWrapper.java:152)
  at com.google.android.gms.maps.GoogleMap$5.onMapClick(Unknown Source)
  at com.google.android.gms.maps.internal.h$a.onTransact(Unknown Source)
  at android.os.Binder.transact(Binder.java:297)
  at bor.a(SourceFile:93)
  at maps.af.q.b(Unknown Source)
  at maps.ap.bo.b(Unknown Source)
  at maps.ap.bk.onSingleTapConfirmed(Unknown Source)
  at maps.bt.g.onSingleTapConfirmed(Unknown Source)
  at maps.bt.i.handleMessage(Unknown Source)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4424)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  at dalvik.system.NativeStart.main(Native Method)
 
Last edited:

javiers

Active Member
Licensed User
Longtime User
Thanks for your answer.
Is there a problem now? I have errors:
image3.bitmap = Main.a.FCIcon (1) ... Invalid index 1, size is 1
 

Laurent95

Active Member
Licensed User
Longtime User
Thanks for your answer.
Is there a problem now? I have errors:
image3.bitmap = Main.a.FCIcon (1) ... Invalid index 1, size is 1
Hi Javiers, the index is from 0 to 4 just 5 days weather.

let me know.
Hi,
Their server don't work yesterday again........ I have also problems with my widget, no update work.
Regards
 
Top