



jeffy2010 wrote:Hi MrSnowflake.
I have resolved the issue and the app is running fine now.
The super of SingleWeatherInfoView which was extending the LinearLayout class had a parameter of "Map", which is not available in the LinearLayout.
Removed the Map, and its working fine.
SingleWeatherInfoView.java - line 41
public SingleWeatherInfoView(Context context, AttributeSet attrs,
Map inflateParams) {
super(context, attrs, inflateParams);
Thank you so much.





aswani wrote:Hi all,
i want to get weather forecast by providing latitude and longitude .
Thanks in advance
Aswan

edreamz wrote:I am getting the following exception, not sure how to debug this . Any help is appreciated.
ERROR/WeatherForcaster(672): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 190: not well-formed (invalid token)


Dliswa wrote:Hi plusminus !
Dear i m quite new to android .When i press the menu key of the emulator the menu does not appear.
can You fix it.
Plllzzzzzzzz
thanks in advance.
package com.android.example;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
public class MenuExample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public boolean onCreatOptionMenu(Menu menu){
super.onCreateOptionsMenu(menu);
menu.add(0, 0, 0, "Hello");
menu.add(0, 1, 0, "World");
return true;
}
}


public class WeatherForcast extends Activity {
// private static final String DEBUG_TAG = null;
private final String DEBUG_TAG = "WeatherForcaster";
/** Called when the activity is first created. */
String cityParam="Copenhagen";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv=new TextView(this);
try{
URL url;
String queryString="http://www.google.com/ig/api?weather="+cityParam;
/* Replace blanks with HTML-Equivalent. */
url=new URL(queryString.replace(" ","%20"));
/* Get a SAXParser from the SAXPArserFactory. */
SAXParserFactory spf=SAXParserFactory.newInstance();
SAXParser sp=spf.newSAXParser();
/* Get the XMLReader of the SAXParser we created. */
XMLReader xr=sp.getXMLReader();
/*
* Create a new ContentHandler and apply it to the
* XML-Reader
*/
WeatherHandler myHandler=new WeatherHandler();
xr.setContentHandler(myHandler);
/* Parse the xml-data our URL-call returned. */
xr.parse(new InputSource(url.openStream()));
/* Our Handler now provides the parsed weather-data to us. */
WeatherSet myWeatherSet=myHandler.getWeatherSet();
/* Update the SingleWeatherInfoView with the parsed data. */
WeatherCurrentCondition wCurrent=new WeatherCurrentCondition();
Integer temp=wCurrent.getTempCelcius();
tv.setText(temp);
}catch(Exception ex){
tv.setText("Error: " + ex.getMessage());
Log.e(DEBUG_TAG, "WeatherQueryError", ex);
}
this.setContentView(tv);
}
}

Users browsing this forum: No registered users and 8 guests