我的代码:
String[] category = {"CA", "Tax consultant", "MR", "Dance trainer"};
ListAdapter categoryAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, category);
ListView categoryListView = (ListView) findViewById(R.id.categoryListView);
categoryListView.setAdapter(categoryAdapter);
如果单击一个项目,我会写什么来更改活动。请告诉我在新活动中写什么?
答案 0 :(得分:0)
使用此代码:
categoryListView.setOnItemClickListener(new OnItemClickListener
{
@override
public void onClick(int position)
{
startActivity(new Intent(getBaseContext(), NewActivity.class));
}
});