I always get this error
public class FlightAvailabityGoActivity extends ListActivity { String[] monthName = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; date userDate=new date(); int DepDay=userDate.getDays(); int DepMonth=userDate.getMonths(); bean beanz=new bean(); private TextView fromToTextView; Calendar calendar = new GregorianCalendar(); String am_pm; String TAG="from"; private TextView from,to; languages lang=new languages(); String En_Ar=lang.getLang(); Element dest; @Override public void onCreate(Bundle savedInstanceState) { try{ Log.v(TAG, "in go activity " +TAG); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.listplaceholder_flightavailabity); if(En_Ar.equals("arabic")) { getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title_flightavailabity_ar);
I am redder about this and I understand it about using the Internet, but I donβt know how to solve it? as you can see, I read XML over HTTP, get XML functions in my class, and it returns the XML in the line here where every thing crashed
Do I need to change the class in String xml = XMLfunctions.getXMLFlightInfo (FromCity);
its the same method as
String xml=XMLfunctions.getXMLFlightAva(FromCity,ToCity);
this is class
public class XMLfunctions { String TAG; public final static Document XMLfromString(String xml){ Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } catch (ParserConfigurationException e) { System.out.println("XML parse error: " + e.getMessage()); return null; } catch (SAXException e) { System.out.println("Wrong XML file structure: " + e.getMessage()); return null; } catch (IOException e) { System.out.println("I/O exeption: " + e.getMessage()); return null; } return doc; } public final static String getElementValue( Node elem ) { Node kid; if( elem != null){ if (elem.hasChildNodes()){ for( kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling() ){ if( kid.getNodeType() == Node.TEXT_NODE ){ return kid.getNodeValue(); } } } } return ""; }
source share