public void bindToListView(List<Forecast_conditions> conditionsList)
    {
    	 //SimpleAdapter simpleAdapter=new SimpleAdapter(this,conditionsList,R.layout.list_item, new String[]{"day_of_week","low","high","icon","condition"},new int[]{R.id.WeekTextView,R.id.lowTextView,R.id.HighTextView,R.id.imageView1,R.id.CondtionTextView});
    	
    //	SimpleAdapter simpleAdapter=new 
    	 
    	// m_weatherListView.setAdapter(simpleAdapter);\
    	
    	List<HashMap<String, Object>> hashMaplst=new ArrayList<HashMap<String,Object>>();
    	
    	for (Forecast_conditions forecast_conditions : conditionsList) {
			HashMap<String, Object> item=new HashMap<String, Object>();
			item.put("day_of_week", forecast_conditions.getDay_of_week());
			item.put("low", forecast_conditions.getLow());
			item.put("high", forecast_conditions.getHigh());
			item.put("icon", forecast_conditions.getHigh());
			item.put("condition", forecast_conditions.getCondition());
			
			hashMaplst.add(item);
		}
    	
    	SimpleAdapter simpleAdapter=new SimpleAdapter(this,hashMaplst,R.layout.list_item, new String[]{"day_of_week","low","high","icon","condition"},new int[]{R.id.WeekTextView,R.id.lowTextView,R.id.HighTextView,R.id.imageView1,R.id.CondtionTextView});
    	m_weatherListView.setAdapter(simpleAdapter);
    	
    	 
    }


//Forecast_conditions 是实体类
//本实例是第一次做Android从各方查来写的代码,很多地方设计不合理。  所以仅供参考  -。-

  m_weatherListView是ListView控件

相关文章:

  • 2022-02-09
  • 2021-08-28
  • 2021-06-04
  • 2022-01-07
  • 2021-07-23
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2021-05-12
  • 2021-08-24
  • 2021-08-19
  • 2021-08-02
  • 2021-06-21
相关资源
相似解决方案