Android 学习笔记
2010-03-31 21:18:00 来源:WEB开发网核心提示:.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap;
.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}
.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}
.codearea pre.alt{ background-color:#f7f7ff !important}
.codearea .lnum{color:#4f81bd;line-height:18px}
1: // Create a button click listener for the List Jobs button.
2: Button btnList = (Button) findViewById(R.id.btnShowList);
3: btnList.setOnClickListener(new Button.OnClickListener() {
4: public void onClick(View v) {
5: Intent intent = new Intent(MicroJobs.this.getApplication(),
6: MicroJobsList.class);
7: startActivity(intent);
8: }
9: });
10:
11: // Load a HashMap with locations and positions
12: List<String> lsLocations = new ArrayList<String>();
13: final HashMap<String, GeoPoint> hmLocations = new HashMap<String, GeoPoint>();
14: hmLocations.put("Current Location", new GeoPoint((int) latitude, (int) longitude));
15: lsLocations.add("Current Location");
16:
17: // Add favorite locations from this user's record in workers table
18: worker = db.getWorker();
19: hmLocations.put(worker.getColLoc1Name(), new GeoPoint((int)worker.getColLoc1Lat(),
20: (int)worker.getColLoc1Long()));
21: lsLocations.add(worker.getColLoc1Name());
22: hmLocations.put(worker.getColLoc2Name(), new GeoPoint((int)worker.getColLoc2Lat(),
23: (int)worker.getColLoc2Long()));
24: lsLocations.add(worker.getColLoc2Name());
25: hmLocations.put(worker.getColLoc3Name(), new GeoPoint((int)worker.getColLoc3Lat(),
26: (int)worker.getColLoc3Long()));
27: lsLocations.add(worker.getColLoc3Name());
28:
29: ArrayAdapter<String> aspnLocations
30: = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
31: lsLocations);
32: aspnLocations.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
33: spnLocations.setAdapter(aspnLocations);
更多精彩
赞助商链接