我有這部分代碼爲微調。但我得到致命的錯誤。這裏有什麼問題?謝謝!我的活動擴展了FragmentActivity。致命錯誤微調和ArrayAdapter
Spinner spinner;
String[] layers = {getString(R.string.a), getString(R.string.b), getString(R.string.c)};
LayoutInflater li = LayoutInflater.from(this);
View v;
v = li.inflate(R.layout.nearest, null);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(MyActivity.this, android.R.layout.simple_spinner_item, layers);
spinner = (Spinner) findViewById(R.id.spinner_nearest);
spinner.setAdapter(adapter);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(v);
builder.setCancelable(true);
AlertDialog alert = builder.create();
alert.show();}
您可以加入logcat的日誌 – 2013-02-22 09:53:24