Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AWSreader extends ListActivity {
- ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_awsreader);
- ((PullToRefreshListView) getListView())
- .setOnRefreshListener(new OnRefreshListener() {
- public void onRefresh() {
- // Do work to refresh the list here.
- InputStreamOperation in= new InputStreamOperation();
- in.execute("");
- }
- });
- }
- class GetDataTask extends AsyncTask<String, Void, HashMap<String, ArrayList<String>>> {
- @Override
- protected void onPostExecute(HashMap<String, ArrayList<String>> p) {
- // **menuItems.addFirst("Added after refresh...");
- for (int i = 0; i < p.headlines.size(); i++) {
- // creating new HashMap
- HashMap<String, String> map = new HashMap<String, String>();
- // adding each child node to HashMap key => value
- map.put("title", p.headlines.get(i));
- map.put("dcdate", p.lstDate.get(i));
- map.put("description", p.description.get(i));
- // adding HashList to ArrayList
- menuItems.add(map);
- }
- ListAdapter rssFeedSection = new SimpleAdapter(AWSreader.this, menuItems,
- R.layout.list_item, new String[] { "title", "dcdate",
- "description" }, new int[] { R.id.name, R.id.date1,
- R.id.desc });
- AWSreader.this.setListAdapter(rssFeedSection);
- super.onPostExecute(result);
- }
- @Override
- protected HashMap<String, ArrayList<String>> doInBackground(String... params) {
- // TODO Auto-generated method stub
- parsing p=new parsing();
- HashMap<String, ArrayList<String>> temphash=p.parse();
- return temphash;
- }
- }
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement