android - Parsing an xml url to display in form of cards -


I am trying to parse an XML file and display the feed as a separate card. My code looks like so far:

  package com.bliss.android.helloworld.main; Import java.io.IOException; Import java.io.InputStream; Import java.net.MalformedURLException; Import java.net.URL; Import java.util.ArrayList; Import org.xmlpull.v1.XmlPullParser; Import org.xmlpull.v1.XmlPullParserException; Import org.xmlpull.v1.XmlPullParserFactory; Import Com.google.android.glass.app.Card; Import Com.google.android.glass.widget.CardScrollAdapter; Import Com.google.android.glass.widget.CardScrollView; Import Android.os.AsyncTask; Importroid.os.Bundle; Import android App Import android.view.View; Import android.view.ViewGroup; Public Classes Extends Secondscreen Activity (ArrayList & lt; Card & gt; Headlines = New Arrelist & lt; Card & gt; (); ArrayList Link = New ArrayList (); @ Override Protected Zero Create (Bundle Saved InstantState ) {Super. NET (set protected); setContentView (R.layout.activity_second); New PostTask (.) Execute ("http://feeds.pcworld.com/pcworld/latestnews"); CardScrollViv CSVCdsView = New CardScrollView (This); CsaAdapter cvAdapter = new csaAdapte R (); csvCardsView.setAdapter (cvAdapter); csvCardsView.activate (); setContentView (csvCardsView);} Private class postastic async Tasks; string, integer, string & gt; {Secure Secure on XXXSite} {Super. Try iterator ();} @ Override protected string doInBackground (string ... parameter) {string URL = param [0]; {XmlPullParserFactory factory = XmlPullParserFactory.newInstance () try; factory.setNamespaceAware (wrong); XmlPullParser xpp = factory .NewPollers (); Inside bullion ITEM = False; // Returns the type of the current event: START_TAG, END_TAG, etc. Int Event Type = xpp.getEventType (); While (eventType! = XmlPullParser.END_DOCUMENT) {if (eventType == XmlPullParser.START_TAG) {if (xpp.getName (.) Equal to ignoreCase ("item")) {insideItem = true; } And if (xpp.getName (.) Ignore equally ("title")) {if (insideItem) {card newCard = new card (seconds screen). NewCard.setText (xpp.nextText ()); Headlines.add (newCard); // remove the title}} and if (xpp.getName (). Equally ignore ("link")) {if (insideItem) links.add (xpp.nextText ()); // extract the link of the article}} and if (eventType == XmlPullParser.END_TAG and XP.Getname (). Ignore equals ("items")) {insideItem = false; } EventType = xpp.next (); // Go to the next element}} Catch (Malfurdurcection E) {e.printStackTrace (); } Hold (XmlPullParserException e) {e.printStackTrace (); } Hold (IOException e) {e.printStackTrace (); } Return URL; }} Private class CSA Adapters Extends CrossScroll Adapter {@ Override Public Intuit Eidiption (Object ID) {Return -1; } @ Override Public Intuit Object (Life Object) {Return to Headlines. Indexoff (item); } @ Override Public In Receipt () {Header Headlines (); } @OverWide Public Object Getitam (Return of the spot) {Return to the spotlight. Condition (status); } @ Override public view getView (integer status, seeviewview, viewgroup parent) {return headlines.get (status) .toView (); }} Public InputStream getInputStream (URL URL) {try {url.openConnection (). GetInputStream (); } Hold (IOException e) {return tap; }}}  

I have not found any errors but nothing has been displayed on the card. I can not understand what the reason is. Because of the card (SeconScreen.this) but if I did not think that it tells me an error that Constructor is not defined


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -