Weather App using Google API Weather return Exception

Put your problem here if it does not fit any of the other categories.

Weather App using Google API Weather return Exception

Postby Barnasanta » Wed Feb 08, 2012 5:57 pm

Hi everybody,
I'm a beginner in Android Programmation and I try to test my skills by following this very good tutorial ( advanced-tutorials-f21/android-weather-forecast-google-weather-api-description-t337.html ).
Unfortunnately, it return me an Error on my Eclipse Project :
Syntax: [ Download ] [ Hide ]
  1. 02-08 16:45:22.956: W/System.err(526): java.lang.NullPointerException 
  2. 02-08 16:45:22.956: W/System.err(526): at com.applizen.meteo.ApiMeteoHandler.startElement(ApiMeteoHandler.java:81) 
  3. 02-08 16:45:22.965: W/System.err(526): at org.apache.harmony.xml.ExpatParser.startElement(ExpatParser.java:145) 
  4. 02-08 16:45:22.965: W/System.err(526): at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method) 
  5. 02-08 16:45:22.965: W/System.err(526): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:518) 
  6. 02-08 16:45:22.965: W/System.err(526): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:479) 
  7. 02-08 16:45:22.975: W/System.err(526): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:318) 
  8. 02-08 16:45:22.975: W/System.err(526): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:275) 
  9. 02-08 16:45:22.975: W/System.err(526): at com.applizen.meteo.MenuActivity$1.onClick(MenuActivity.java:69) 
  10. 02-08 16:45:22.975: W/System.err(526): at android.view.View.performClick(View.java:2485) 
  11. 02-08 16:45:22.975: W/System.err(526): at android.view.View$PerformClick.run(View.java:9080) 
  12. 02-08 16:45:22.975: W/System.err(526): at android.os.Handler.handleCallback(Handler.java:587) 
  13. 02-08 16:45:22.986: W/System.err(526): at android.os.Handler.dispatchMessage(Handler.java:92) 
  14. 02-08 16:45:22.986: W/System.err(526): at android.os.Looper.loop(Looper.java:123) 
  15. 02-08 16:45:22.986: W/System.err(526): at android.app.ActivityThread.main(ActivityThread.java:3683) 
  16. 02-08 16:45:22.986: W/System.err(526): at java.lang.reflect.Method.invokeNative(Native Method) 
  17. 02-08 16:45:22.986: W/System.err(526): at java.lang.reflect.Method.invoke(Method.java:507) 
  18. 02-08 16:45:22.996: W/System.err(526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
  19. 02-08 16:45:22.996: W/System.err(526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
  20. 02-08 16:45:22.996: W/System.err(526): at dalvik.system.NativeStart.main(Native Method) 


I attached my Ecclipse Project if someone want to see it :) ! A big big big thanks for the guy who will find the solution !!
Attachments
titi.zip
(105.32 KiB) Downloaded 25 times
Barnasanta
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Feb 08, 2012 5:00 pm

Top

Re: Weather App using Google API Weather return Exception

Postby Phyll » Thu Feb 09, 2012 1:16 pm

Hi Barnasanta,

I could not make that code work either. But I can tell you where it fails and a couple of other things.

Code: Select all
I changed this:

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

And made the parser code look like this:

   SAXParserFactory spf = SAXParserFactory.newInstance();
   SAXParser sp = spf.newSAXParser();
   XMLReader xr = sp.getXMLReader();
   ApiMeteoHandler handler = new ApiMeteoHandler();
   xr.setContentHandler((ContentHandler) handler);
   xr.parse(new InputSource(new StringReader(requeteString)));



Then I get this error:

02-09 07:07:31.848: E/com.applizen.meteo(4043): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 5: not well-formed (invalid token)

Not sure why it doesn't work. That's as close as I came.

Hope this helps. If you figure it out please let us know.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests