Android 数据库与MapView总结
2010-11-05 00:54:34 来源:WEB开发网import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
public class EX10_06_04 extends MapActivity{
private TextView mTextView01;
/* 独一无二的menu选项identifier,用以识别事件 */
static final private int MENU_ADD = Menu.FIRST;
static final private int MENU_EDIT = Menu.FIRST+1;
static final private int MENU_DRAW = Menu.FIRST+2;
/* Google地图所需成员变量 */
private MapView mMapView01;
private int intZoomLevel=20;
/* 数据库所需成员变量 */
private MySQLiteOpenHelper dbHelper=null;
private int version = 1;
private List allRestaurantID;
private List allRestaurantName;
private List allRestaurantAddress;
private List allRestaurantCal;
/* 数据库数据表 */
private String tables[] = { "t_restaurant" };
/* 数据库字段名称 */
private String fieldNames[][] =
{
{ "f_id", "f_name", "f_address", "f_cal" }
};
/* 数据库字段数据类型 */
private String fieldTypes[][] =
{
{ "INTEGER PRIMARY KEY AUTOINCREMENT", "text" , "text", "text"}
};
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_draw);
mTextView01 = (TextView)findViewById(R.id.myTextView7);
/* 创建MapView对象 */
mMapView01 = (MapView)findViewById(R.id.myMapView1);
/* 数据库连接 */
dbHelper = new MySQLiteOpenHelper
(this, "mydb", null, version, tables, fieldNames, fieldTypes);
更多精彩
赞助商链接