0
當我嘗試調用片段中的意圖時,出現「無法解析方法getIntent()」。getIntent()在片段內
這裏是我的代碼
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_browse_product,null);
if(getIntent().getBooleanExtra("Exit me", false)){
finish();
return; // add this to prevent from doing unnecessary stuffs
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarBrowse);
setSupportActionBar(toolbar);
spnCategory = (Spinner)findViewById(R.id.spinnerCategory);
spnCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
}
public void onNothingSelected(AdapterView<?> adapterView) {
return;
}
});