package com.coltonnicotera.londontransitguide;
//bunch of imports
public class SchedulesActivity extends Activity {
/** Called when the activity is first created. */
List<Map<String, String>> routesList = new ArrayList<Map<String,String>>();
String[] routesArray = new String[] {"01. Kipps Lane/Thompson Road", "02. Dundas", "03. Hamilton Rd", "04. Oxford East", "05. Springbank", "06. Richmond", "07. Wavell", "08. Riverside", "09. Whitehills", "10. Wonderland", "11. Southcrest", "12. Warncliffe South", "13. Wellington Road", "14. Highbury", "15. Westmount", "16. Adelaide", "17. Oxford West", "19. Oakridge", "20. Cherryhill", "21. Huron Heights", "22. Trafalgar", "23. Berkshire", "24. Baseline", "25. Kilally", "26. Jalna Blvd. West", "27. Fanshawe College", "28. Lambeth", "30. Newbold", "31. Orchard Park", "32. Windermere", "33. Proudfoot", "34. Medway", "35. Argyle", "36. Airport/Industrial", "37. Sovereign Road", "38. Stoney Creek", "39. Fanshawe West"};
public void onCreate(Bundle savedInstanceState) {
initList();
ListView lv = (ListView) findViewById(R.id.listView);
SimpleAdapter simpleAdpt = new SimpleAdapter(this, routesList, android.R.layout.simple_list_item_1, new String[] {"route"}, new int[] {android.R.id.text1});
/*LINE 63 */ lv.setAdapter(simpleAdpt);
}
private void initList() {
for (int i = 0; i<=36; i++)
routesList.add(createRoute("route", routesArray[i]));
}
private HashMap<String, String> createRoute(String key, String name) {
HashMap<String, String> route = new HashMap<String, String>();
route.put(key, name);
return route;
}
}
我的问题是在第 63 行有一个 NullPointerException。我不确定这里究竟是什么。为简单起见,我删除了所有导入。R.id.listView 也存在。