B4A Library ICOSWorldForecast 3.50

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, u r right I'm so sorry about this inconvenience but did u tried my demo? it work to u.
No worries Giuseppe it's me who had does a mistake.
That teach me that we must pay attention to survey all changes between two versions.
It's not to you to ask forgiveness already you work for us.

Yes your example work fine and it's from it that i discover my mistake.
Now both work fine, your and mine

Grazie Giuseppe.

Ciao.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Giuseppe, i have this problem:

B4X:
a.Initialize("a")  
    a.ApiKey="m7sutqf7uXXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    lat = a.Latitude
    lon = a.Longitude
    a.LatAndLong = lat & "," & lon
    citta = a.FindLocation

give me error... or for better explain return citta empty.
if i add this code i haven't problem:

B4X:
a.Initialize("a")  
    a.ApiKey="m7sutqf7uxdbr6XXXXXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    a.CityName="rome"
    lat = a.Latitude
    lon = a.Longitude
    a.LatAndLong = lat & "," & lon
    citta = a.FindLocation


WhY ?
i want give my city with gps ( the code return coordinate right )
Thank you for all.

Italiano:
Ciao Giuseppe ho questo problema:

B4X:
[CODE]a.Initialize("a")
    a.ApiKey="m7sutqf7uXXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    lat = a.Latitude
    lon = a.Longitude
    a.LatAndLong = lat & "," & lon
    citta = a.FindLocation
[/CODE]

Questo codice torna errore dandomi lat come errore, differentemente se aggiungo prima la linea " a.CityName="rome" " è ok.
Ora vorrei prelevare tramite la funzione LatAndLong direttamente la posizione del tipo:

B4X:
    a.Initialize("a")  
    a.ApiKey="m7sutqf7uxdbrXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    lat = a.Latitude
    lon = a.Longitude
    a.LatAndLong = lat & "," & lon
    citta = a.FindLocation
    ImageView1.Bitmap = a.FCIcon(0)
    Label1.Text = "Firenight " & a.CCTempFahrenheit
    Label2.Text = "Celsius " & a.CCTempCelsius & "°"
  
    ImageView2.Bitmap = a.FCIcon(1)
    Label3.Text = "Tempo domani"
    Label4.Text =  a.FindLocation

. Potresti cortesemente farmi un esempio ?
Grazie mille e ottima libreria
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User

Hello,

Giuseppe has already responded to this, it's necessary you test if the Website respond before.
You must have your own account on http://www.geonames.org/ and use it with declaration like, a.SetGeoUserName ="your_own_user_account".
Take a look at this message of Giuseppe, http://www.b4x.com/android/forum/threads/icosworldforecast-3-10.21852/page-17#post-247863

We discuss about several time before, even if other problem has appeared that still necessary you use your own account.
It's probably why you have an issue.
Take a look at the example attached, all things needed are inside, don't forget to put your own apiKey on WWO and your username on the geonames.org

Regards.
 

Attachments

  • ICOSWorldForecast_v3.10Demo.zip
    36.2 KB · Views: 200
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
@ MarcoRome

Hello,

You're right i have read so quick last time and unfortunatly i don't use the IP adress in this example.
Seems this old function 'a.LatAndLong' don't work now, you must replace it by 'a.WeaterByLocalIpAddress=a.LocalIpAddress' .
Or 'a.WeaterByLocalIpAddress=lat & "," & lon' but you use 2 variables for nothing unless you use them after.

In your second case the Website respond because the city is iniitalized.

But my first response still correct you need to follow what Giuseppe say about the geoname user account.

Good prog.

Regards.
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi all.
The app work fine but in sometime give me this error:
"An error has occurred in sub: java.lang.NullPointerException: Error Parsing Weather!!!!"

Any help is appreciated.
Thanks
 

MarcoRome

Expert
Licensed User
Longtime User
Thank you for your response.
"Error Parsing Weather!!!!" i see when internet connect i lost. So i resolve with server.GetMyIP = "127.0.0.1" ....
I have one question for you
With your library, you can intercept using gps the place and pass that parameter or you must always enter a.CityName="example name city".
Thank you
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Giuseppe i try a.CityName = a.FindLocation but without success:

B4X:
a.Initialize("a")

    a.ApiKey="m7sutqf7uXXXXXXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    a.CityName = a.FindLocation
    Label1.Text = "Firenight " & a.CCTempFahrenheit
    Label2.Text = "Celsius " & a.CCTempCelsius & "°"
    ImageView1.Bitmap = a.FCIcon(0)

if i utilize a.CityName = "New York" ' or another place work without problem:

B4X:
a.Initialize("a")

    a.ApiKey="m7sutqf7uXXXXXXXXXXXX"
    Activity.LoadLayout("1")
    a.Initialize("a")
    a.CityName = "New York" ' or another place
    Label1.Text = "Firenight " & a.CCTempFahrenheit
    Label2.Text = "Celsius " & a.CCTempCelsius & "°"
    ImageView1.Bitmap = a.FCIcon(0)

what you think ?
Thank you
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Marco, this is just a way to get the location but u can use different way.

B4X:
Sub Button1_click
If a.isWiFiConnected = True Then
    If a.FindLocation.Length > 0 Then
 
      a.CityName = a.FindLocation
      StartActivity(Forecast)

    End If
End If
End Sub

Or

Sub Button1_click
If a.isWiFiConnected = True Then
   If a.FindLocation.Length > 0 Then
     Try
      a.CityName = a.FindLocation
      StartActivity(Forecast)
     Catch
       ToastMessageShow(" Probably server error!! ",True)
     End Try
    End If
End If
End Sub
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Giuseppe i already try this way . The internet connection work ( infact if you put in a.City = "name city" work very well and show me temperature ico ..etc. ) i think that is a.Findlocation taht have problem because is null as value.
I use Library ICOSWorldForecast 2.84.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Marco, did u tried the first option? let me know.


B4X:
Sub Button1_click
If a.isWiFiConnected = True Then
    If a.FindLocation.Length > 0 Then
      a.CityName = a.FindLocation
      StartActivity(Forecast)

    End If
End If
End Sub

P.S.

I'll implement a broadcast receive as soon as i finish the new GridView.



Which kind of program u use to record the video.
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Yes Giuseppe but as you see in movie in the findlocation.Length is null and so jump .... i use for movie camtasia studio 8.
it is possibile get sCityNames, because there is correct value.
this is my email info@queenandroid.com
Thank you again
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…