2012-03-23 65 views

回答

1

嘗試這樣

@Override 
protected void onListItemClick(ListView l, View v, int position, long id) { 
    Intent i=new Intent(yourActivity.this,next.class); 


    String s = this.getListAdapter().getItem(position); 
    //query the database for the row with this string.. and get the necessary information 

    i.putExtra("name",s1); 
    i.putExtra("id",s2); 
    startActivity(i); 



} 
+0

yea @raju那爲我工作。 – 2012-03-27 03:23:56

+0

但你應該upvote atleast ... – 5hssba 2012-03-27 05:29:33

2

創建一個僅顯示所選項目的詳細信息的新活動。此活動是爲每個項目創建的,但您會打開它,然後按下後退按鈕以不同的內容再次打開它。查看Intent及其附加內容,瞭解如何將數據傳遞到您的詳細信息活動。

+0

you.Canü闡述我沒有得到什麼? – 2012-03-23 20:38:13

+0

@DineshVenkata意圖用於在活動之間進行導航。你需要一個'DetailActivity',並通過一個Intent發送一些啓動數據。檢查了這一點:http://developer.android.com/guide/topics/intents/intents-filters.html – Josh 2012-03-23 21:16:03

相關問題