これは、ListActivity リストをクリックするとactivity、各アトラクションの詳細を示す新しいリストが開始されます。完全な詳細ページを実装する方法がわかりません。以前の からデータを取得する完全な詳細アクティビティのコードをいくつか見せてもらえますlistか?
パブリック クラス アトラクションリスト アクティビティは、リスト アクティビティを拡張します {
プライベート スタティック 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;
@オーバーライド
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = 新しい MyDB(これ);
mDbHelper.open();
c = mDbHelper.getplaces();
setListAdapter(新しい SimpleCursorAdapter(これ、
R.layout.list_place、c、
からの));
最終的な ListView lv = getListView();
lv.setOnItemClickListener(新しいOnItemClickListener() {
public void onItemClick(AdapterView 親、ビュー ビュー、int 位置、長い ID) {
Intent newActivity = new Intent(view.getContext(), Place.class);
startActivity(newActivity);
}
});
}
}
AttractionlistActivity.Class からのアクションを処理するためにこのアクティビティを実装する方法がわかりません
public class Place extends Activity {
private static final String CLASSTAG = Place.class.getSimpleName();
プライベート TextView タイトル。
プライベート TextView の詳細。
プライベート TextView の場所。
プライベート TextView 電話;
プライベート ImageView placeImage;
public void 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);
}
}