Android 单击listview时在“活动”中显示不同的信息

Android 单击listview时在“活动”中显示不同的信息,android,arrays,android-intent,android-listview,row,Android,Arrays,Android Intent,Android Listview,Row,我希望listview在单击listview的某一行时打开一个新活动并显示某些信息。 到目前为止,我只能在单击每一行时显示相同的信息。我不知道如何为特定行设置这些信息,例如,当我单击第1行时,会显示此地址;当我单击第2行时,会显示另一个地址……我的代码如下 第一项活动 // storing string resources into Array String []Buildings_halls = getResources().getStringArray(R.array.halls);

我希望listview在单击listview的某一行时打开一个新活动并显示某些信息。 到目前为止,我只能在单击每一行时显示相同的信息。我不知道如何为特定行设置这些信息,例如,当我单击第1行时,会显示此地址;当我单击第2行时,会显示另一个地址……我的代码如下

第一项活动

 // storing string resources into Array
 String []Buildings_halls = getResources().getStringArray(R.array.halls);
    // Binding resources Array to ListAdapter
    this.setListAdapter(new ArrayAdapter<String>(this, R.layout.hallstudent, R.id.listhall, Buildings_halls));

 }

 protected void onListItemClick(ListView lv, View v, int position, long id){
     super.onListItemClick(lv, v, position, id);     

Intent intent = new Intent(StudentHall.this, StudentHallSelect.class);
Bundle bundle = new Bundle();
bundle.putInt("position", position);
// Or / And
intent.putExtra("id", String.valueOf(id));
intent.putExtra("description",getResources().getStringArray(R.array.hallsdescription));
intent.putExtras(bundle);
startActivity(intent);

        }               

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    finish();
}
}
i、 e我要显示的第1行的信息

<string-array name="descriptions">
           <item>Address:</item>
                <item>  Contact: </item>
                      <item>OpeningHours:</item>
               </string-array>
  <string-array name="hallsdescription">
           <item >Address:, Telephone No:,Opening Times:</item>
           <item >Address:Catherine Street, Telephone No:657263912739,Opening Times:23:00</item>
i、 e我要显示的第1行的信息

<string-array name="descriptions">
           <item>Address:</item>
                <item>  Contact: </item>
                      <item>OpeningHours:</item>
               </string-array>
  <string-array name="hallsdescription">
           <item >Address:, Telephone No:,Opening Times:</item>
           <item >Address:Catherine Street, Telephone No:657263912739,Opening Times:23:00</item>
谢谢

在你的第二个活动中

txt.setText(getIntent().getExtras().getString("description"));

检查相同问题的答案