Android development blog
Tutorials about Android dev topics

Android WeatherLib: A new lib to create Android Weather App easily and fast

I've published at github a new library that makes easier to develop weather app providing a framework to get actual, forecast weather and much more.
The lib helps you to focus only on the app without worrying about details regarding:


  • Remote service invocation 
  • HTTP request response handling 
  • Thread and ANR problems 
  • Search city by current geographics coordinates
  • Search city by name pattern
  • Weather provider protocol parser
  • Retrieve weather icons
This is a library project that helps developers to create easily weather app without worrying about querying and extracting information from remote weather servers. It is very simple to use and you can easily extend it to support different weather provider or you can customize it according to your needs.
By now it supports two main weather provider:
I've implemented a demo app (under demo module) that shows how to use the lib. At github there is moreover a short introduction about the main concepts that stand at lib base and how you can use it.


If you like it please help me to share this information. 
I've created a community where you can help me to improve the lib, discuss about it or give  some tips or ask for  new features. If you are interested please join it.

Project repository

G+ Community

Android app development :weather app with forecast

5 comments:

  1. I am having alot of issues getting your demo into eclipse, it worked once under import into workspace, I added the library and then the app would crash after launch, missing class file. Any suggestions as to how this should get imported would be appreciated, I a working from the zip from github

    ReplyDelete
  2. 04-13 11:04:08.606: E/AndroidRuntime(20607): FATAL EXCEPTION: main
    04-13 11:04:08.606: E/AndroidRuntime(20607): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.survivingwithandroid.weatherapp/com.survivingwithandroid.weatherapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.survivingwithandroid.weatherapp.MainActivity" on path: /data/app/com.survivingwithandroid.weatherapp-1.apk
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2348)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread.access$700(ActivityThread.java:159)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.os.Handler.dispatchMessage(Handler.java:99)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.os.Looper.loop(Looper.java:137)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread.main(ActivityThread.java:5414)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at java.lang.reflect.Method.invokeNative(Native Method)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at java.lang.reflect.Method.invoke(Method.java:525)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at dalvik.system.NativeStart.main(Native Method)
    04-13 11:04:08.606: E/AndroidRuntime(20607): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.survivingwithandroid.weatherapp.MainActivity" on path: /data/app/com.survivingwithandroid.weatherapp-1.apk
    04-13 11:04:08.606: E/AndroidRuntime(20607): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
    04-13 11:04:08.606: E/AndroidRuntime(20607): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
    04-13 11:04:08.606: E/AndroidRuntime(20607): ... 12 more

    ReplyDelete
  3. survivingwithandroidApril 13, 2014 at 6:11 PM

    In my opinion you missed the Main class or your package structure isn't correct. You could try to rebuild everything to be sure the new classes are included. Let me know if you still have problems

    ReplyDelete
  4. Once it is imported the class files all end up under a java->com->survivingwithandroid-> folder instead of the source. I moved them to source under the correct package, then all of the imports are broken for the library. I spent an hour trying to figure out how this should have been imported, no idea. Maybe I'm the only one which seems to be the case with the other odd code bug, which makes no sense.

    ReplyDelete
  5. survivingwithandroidApril 13, 2014 at 8:58 PM

    It is strange. Anyway IMO you should:
    Create a new Project called Lib and copy everything under lib module. When you create this project remember to mark it as Library.
    Second create a new Project calling it App and create a dependency with the Lib project. Be aware of AndroidManifest.xml because there should be a wrong package. Second try to delete gen files and all the classes genereted. I will try to set up an Eclipse project

    ReplyDelete

Related Posts with Thumbnails