我可以将数据getStringExtra()
与字符串进行比较吗?示例代码:
Intent intent = getIntent();
String path = intent.getStringExtra("category");
if(path == "car"){
setListAdapter(new ArrayAdapter<String>(this, R.layout.subcategory, car));
} else {
setListAdapter(new ArrayAdapter<String>(this, R.layout.subcategory, bike));
}
为什么脚本没有运行?