ListViewの各エントリはどのようにして別のActivityにジャンプしますか?
1555 ワード
ListViewの各エントリはどのようにして別のActivityにジャンプしますか? <span style="font-size:18px;"><span style="color:#33cc00;"> </span>public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.group);
listView=(ListView)findViewById(R.id.group1_list);
listItems=getlistItems();
listViewAdapter=new ListViewAdapter(this, listItems);
listView.setAdapter(listViewAdapter);
listView.setTextFilterEnabled(true);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
Log.i("mm", " onItemClick ");
Intent intent=new Intent();
switch(position){
case 0:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
case 1:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
case 2:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
}
}
});
}</span>
<span style="font-size:18px;"><span style="color:#33cc00;"> </span>public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.group);
listView=(ListView)findViewById(R.id.group1_list);
listItems=getlistItems();
listViewAdapter=new ListViewAdapter(this, listItems);
listView.setAdapter(listViewAdapter);
listView.setTextFilterEnabled(true);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
Log.i("mm", " onItemClick ");
Intent intent=new Intent();
switch(position){
case 0:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
case 1:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
case 2:
intent.setClass(getApplicationContext(), ListViewGroup.class);
GroupActivity.this.startActivity(intent);
break;
}
}
});
}</span>