0
countryCodeSpinner
在下面的代碼片段中顯示爲null
。微調框返回null
countryCodeSpinner = (Spinner) findViewById(R.id.spinner_country);
countryCodeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
selectedCountryCode = (Long) selectedItemView.findViewById(R.id.country_name).getTag();
}
代碼遍佈全球,請更正。併爲代碼添加一些上下文。 – iMan
也許你的佈局中沒有R.id.spinner_country的資源。 請確保您選擇了正確的佈局 – Adnan
@avinash tiwari refere [this](http://stackoverflow.com/help/how-to-ask)befor提問 – Nikhil