这是我的第一个活动代码:
public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(Categories.this, Books.class);
final String selectedCategory = (String) parent.getSelectedItem();
i.putExtra("category", selectedCategory);
startActivity(i);
}
这是我的第二项活动:
Intent passedCategory =getIntent();
String vCategory = passedCategory.getStringExtra("category");
TextView v = (TextView)findViewById(R.id.CategoryPass);
v.setText(vCategory);
CategoryPass
- XML文件中TextView
的ID
当我运行它时它不会向我显示TextView
中的任何内容,我做错了什么?