這是我的ListActivity點擊列表後,它將啓動顯示每個景點的全部細節的新活動。我不知道如何實現完整的詳細信息頁面。你們可以向我展示一些完整的細節活動代碼,它可以回顧以前列表中的數據。如何設置視圖或活動來處理以前的列表活動?例如「查看完整的詳細信息頁面」
public class AttractionsListActivity extends ListActivity { private static MyDB mDbHelper; String[] from = new String[] { Constants.TITLE_NAME , Constants.ADDRESS_NAME }; int[] to = new int[] {R.id.place_title, R.id.place_address}; private Cursor c; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new MyDB(this); mDbHelper.open(); c = mDbHelper.getplaces(); setListAdapter(new SimpleCursorAdapter(this, R.layout.list_place, c, from, to)); final ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View view,int position, long id) { Intent newActivity = new Intent(view.getContext(), Place.class); startActivity(newActivity); } }); } }
我不知道如何實現這個活動來對付行動從AttractionslistActivity.Class
public class Place extends Activity { private static final String CLASSTAG = Place.class.getSimpleName(); private TextView title; private TextView detail; private TextView location; private TextView phone; private 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); } }
你有任何示例代碼。我對編程非常陌生。對我的窮人抱歉。 – 2011-05-31 02:10:10
@四月,你應該做的記事本教程它解釋得很好 – wired00 2011-05-31 02:22:53
@四月@Programmer布魯斯建議,看看記事本教程 – aromero 2011-05-31 02:23:42