2012-03-23 63 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

相关问题