So I am creating a simple RSS reader. I managed to implement
ListActivity and to fill it with desired data(rss titles). However,
now I wanted to implement onItemSelectedListener() method in order to
show the description of rss on the next Activity. Here is the code:
package stefan.rssreader;
import java.util.ArrayList;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class B92Rss extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RssStorage storage = new RssStorage();
RssFeed currentFeed;
ArrayList<String> titles = new ArrayList<String>();
ArrayList<String> descriptions = new ArrayList<String>();
try{
storage.fillFeeds("http://www.b92.net/info/rss/vesti.xml");
}catch(Exception e){}
for(int i=0;i<storage.getSize();i++){
currentFeed = storage.getNextFeed();
titles.add(currentFeed.getTitle());
descriptions.add(currentFeed.getDescription());
}
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, titles));
getListView().setTextFilterEnabled(true);
}
}
So in order to implement this, I need to somehow declare titles and
descriptions variables outside onCreate() method. I tried but then the
list is empty and it doesn't work!
How exactly do I do this? Please help. I searched the web but couldn't
find explanation for this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---