这是我ListActivity 点击列表后,它将开始一个新的activity,显示每个景点的完整细节。我不知道如何实现完整的详细信息页面。你们能告诉我一些从以前检索数据的完整详细活动代码list吗?
公共类 AttractionsListActivity 扩展 ListActivity {
私有静态 MyDB mDbHelper;
String[] from = new String[] { Constants.TITLE_NAME , Constants.ADDRESS_NAME };
int[] to = new int[] {R.id.place_title, R.id.place_address};
私人光标 c;
@覆盖
公共无效 onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new MyDB(this);
mDbHelper.open();
c = mDbHelper.getplaces();
setListAdapter(新的 SimpleCursorAdapter(这个,
R.layout.list_place, c,
从到));
最终列表视图 lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View view,int position, long id) {
意图 newActivity = new Intent(view.getContext(), Place.class);
开始活动(新活动);
}
});
}
}
我不知道如何实现这个活动来处理来自 AttractionslistActivity.Class 的动作
公共类地方扩展活动{
私有静态最终字符串 CLASSTAG = Place.class.getSimpleName();
私有 TextView 标题;
私有 TextView 详细信息;
私有 TextView 位置;
私人 TextView 电话;
私有 ImageView placeImage;
公共无效 onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(Constants.TAG, " " + Place.CLASSTAG + " onCreate");
this.setContentView(R.layout.detail_place);
this.title = (TextView) findViewById(R.id.name_detail);
//title.setText(cursor.getString(Constants.TITLE_NAME));
this.detail = (TextView) findViewById(R.id.place_detail);
this.location = (TextView) findViewById(R.id.location_detail);
this.phone = (TextView) findViewById(R.id.phone_detail);
this.placeImage = (ImageView) findViewById(R.id.place_image);
}
}