Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. public class AWSreader extends ListActivity {
  2.  
  3. ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
  4.  
  5.  
  6.  
  7. @Override
  8. protected void onCreate(Bundle savedInstanceState) {
  9. super.onCreate(savedInstanceState);
  10. setContentView(R.layout.activity_awsreader);
  11. ((PullToRefreshListView) getListView())
  12. .setOnRefreshListener(new OnRefreshListener() {
  13. public void onRefresh() {
  14. // Do work to refresh the list here.
  15. InputStreamOperation in= new InputStreamOperation();
  16.  
  17. in.execute("");
  18. }
  19. });
  20.  
  21. }
  22.  
  23. class GetDataTask extends AsyncTask<String, Void, HashMap<String, ArrayList<String>>> {
  24. @Override
  25. protected void onPostExecute(HashMap<String, ArrayList<String>> p) {
  26. // **menuItems.addFirst("Added after refresh...");
  27. for (int i = 0; i < p.headlines.size(); i++) {
  28. // creating new HashMap
  29. HashMap<String, String> map = new HashMap<String, String>();
  30. // adding each child node to HashMap key => value
  31. map.put("title", p.headlines.get(i));
  32. map.put("dcdate", p.lstDate.get(i));
  33. map.put("description", p.description.get(i));
  34. // adding HashList to ArrayList
  35. menuItems.add(map);
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. ListAdapter rssFeedSection = new SimpleAdapter(AWSreader.this, menuItems,
  44. R.layout.list_item, new String[] { "title", "dcdate",
  45. "description" }, new int[] { R.id.name, R.id.date1,
  46. R.id.desc });
  47. AWSreader.this.setListAdapter(rssFeedSection);
  48. super.onPostExecute(result);
  49. }
  50.  
  51. @Override
  52. protected HashMap<String, ArrayList<String>> doInBackground(String... params) {
  53. // TODO Auto-generated method stub
  54. parsing p=new parsing();
  55. HashMap<String, ArrayList<String>> temphash=p.parse();
  56. return temphash;
  57. }
  58. }
  59.  
  60. @Override
  61. protected void onListItemClick(ListView l, View v, int position, long id) {
  62.  
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement