1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 private void drawRestaurant()
  { 
    String f[] = { "f_id", "f_name", "f_address", "f_cal"};
    /* SELECT f[] FROM tables[0] */
    Cursor c = dbHelper.select(tables[0], f, "", null, null, null, null);
    allRestaurantID = new ArrayList<String>();
    allRestaurantName = new ArrayList<String>();
    allRestaurantAddress = new ArrayList<String>();
    allRestaurantCal = new ArrayList<String>();
    
    /* 將所有餐廳資料放入List<String>物件 */
    while (c.moveToNext())
    {
      allRestaurantID.add(c.getString(0));
      allRestaurantName.add(c.getString(1));
      allRestaurantAddress.add(c.getString(2));
      allRestaurantCal.add(c.getString(3));
    }
    
    if(allRestaurantID.size()>0)
    {
     
      for (int i=0;i<allRestaurantID.size();i++)
       {
                   
        
         mTextView01.setText
        (
          allRestaurantName.get(i)+"\n"+
          allRestaurantAddress.get(i)+"\n"+
          allRestaurantCal.get(i)        
        );        
         
      /* 以地址查詢地理座標 */
      GeoPoint gp = getGeoByAddress(allRestaurantAddress.get(i));
      if(gp==null)
      {
        /* 地址無法反查為GeoPoint時 */
        mMapView01.setVisibility(MapView.GONE);
      }
      else
      { 
        
        /* 更新MapView地圖 */
        mMapView01.setVisibility(MapView.VISIBLE);
        showImageOverlay(gp);
        //取得位址後更新顯示
  refreshMapViewByGeoPoint(getGeoByAddress(allRestaurantAddress.get(i)), mMapView01, intZoomLevel, true);
       }
     }
   }
  }