Hi
can any one  tell me how to read dynamic list view help me for what i
mademistake
public class Lookup extends ListActivity {
        
        private TextView title,updated,name,locationID,loocationName;
        ArrayList<lookupforecastfeed> list = new 
ArrayList<lookupforecastfeed>();
        private lookupforecastfeed feeds = new lookupforecastfeed();
        private lookupforecasthandler handler;
        

        private ListView listview;
        private Context mContext;
        private Button lookup;
        
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.location);
        mContext = this;
       title=(TextView)findViewById(R.id.locationname);

       String[] names = new String[] { "name","locationName","locationID" };
       setListAdapter(new ArrayAdapter<String>(this,
                                R.layout.locationame,R.id.title,
                                 names));


        new lookupForecastRetriever().execute();
        }
class lookupForecastRetriever extends AsyncTask<Void, Void, Void>{
         @Override
        protected void onPostExecute(Void result) {
                // TODO Auto-generated method stub
                  // super.onPostExecute(result);
                
                    handler = new lookupforecasthandler();
                    list = handler.getForecasts(mContext);
                    title.setText(list.get(0).getTitle());
                
                
                
        progressDialog.dismiss();
        Log.v("DailyForecast","FeedLocationName"+feeds.getLocationName());

         }
        private ProgressDialog progressDialog;
        
         protected void onPreExecute() {
        progressDialog = ProgressDialog.show(Lookup.this,
                          "", "Loading. Please wait...", true);
}
        @Override
        protected Void doInBackground(Void... params) {
        
                return null;
        }

//

public class lookupforecasthandler extends DefaultHandler {
        private lookupforecastfeed feeds = new lookupforecastfeed();
        StringBuffer chars = new StringBuffer();
        ArrayList<lookupforecastfeed> list = new 
ArrayList<lookupforecastfeed>();
        @Override
        public void characters(char[] ch, int start, int length)
                        throws SAXException {
                // TODO Auto-generated method stub
                chars.append(new String(ch, start, length));

                //super.characters(ch, start, length);
        }

        @Override
        public void endElement(String uri, String localName, String qName)
                        throws SAXException {
                // TODO Auto-generated method stub
                super.endElement(uri, localName, qName);
                if(localName.equalsIgnoreCase("title"))
                {
                        feeds.setTitle(chars.toString());
                }
                if(localName.equalsIgnoreCase("locationName"))
                {
                        
list.get(list.size()-1).setLocationName(chars.toString());
                }
                if(localName.equalsIgnoreCase("locationID"))
                {
                        list.get(list.size()-1).setLocationID(chars.toString());
                }
                if(localName.equalsIgnoreCase("name"))
                {
                        feeds.setName(chars.toString());
                }
                if(localName.equalsIgnoreCase("upDated"))
                {
                        feeds.setUpdated(chars.toString());
                }
                
        }

        @Override
        public void startElement(String uri, String localName, String qName,
                        Attributes attributes) throws SAXException {
                // TODO Auto-generated method stub
        //      super.startElement(uri, localName, qName, attributes);
                chars = new StringBuffer();
                if(localName.equalsIgnoreCase("location"))
                {
                        list.add(new lookupforecastfeed());
                }
        }

        
        public ArrayList<lookupforecastfeed> getForecasts(Context mContext)
        {
                
                try {

                        SAXParserFactory spf = SAXParserFactory.newInstance();
                        SAXParser sp = spf.newSAXParser();
                        XMLReader xr = sp.getXMLReader();


                        xr.setContentHandler(this);
                        
                        Resources resources = mContext.getResources();
                        InputStream openRawResource = 
resources.openRawResource(R.raw.lookup);
                        xr.parse(new InputSource(openRawResource));

                } catch (IOException e) {
                        Log.e("RSS Handler IO", e.getMessage() + " >> " + 
e.toString());
                } catch (SAXException e) {
                        Log.e("RSS Handler SAX", e.toString());
                } catch (ParserConfigurationException e) {
                        Log.e("RSS Handler Parser Config", e.toString());
                }

                return list;
        }

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to