我使用這個搜索微調https://github.com/miteshpithadiya/SearchableSpinner/我需要幫助填補這個從程序字符串數組項
我收到來自PHP我的JSON結果,然後將其解析爲一個字符串數組使用此代碼
定製庫微調try {
JSONArray JA = new JSONArray(result);
JSONObject json = null;
fullname = new String[JA.length()];
for (int i = 0; i < JA.length(); i++) {
json = JA.getJSONObject(i);
fullname[i] = json.getString("fullname");
}
// Toast.makeText(getApplicationContext(), "Data Loaded",
Toast.LENGTH_LONG).show();
for (int i = 0; i < fullname.length; i++) {
instslist.add(fullname[i]);
}
和我用這填補了微調
instSpinner.findViewById(R.id.floatspinner);
instSpinner.setTitle("Select Instructor");
instSpinner.setPositiveButton("OK");
ArrayAdapter<String> dataAdapter1 = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_spinner_item, instNames);
dataAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
instSpinner.setAdapter(dataAdapter1);
,但沒有被顯示在列表中。幫助將不勝感激
它使用全名數組不像instNames就像即時通訊使用。哪一個不起作用,我在netbeans中編譯代碼來檢查數組是否具有解析的json數據,並且它確實如此。不知道爲什麼這不起作用。 –