中解決在我的活動中有一個錯誤,在這行(Home.this,android.R.layout.activity_home, searchResults));
其中說「activity_home無法解析」,但如果我給作爲single_list_item_1提到的教程之一,錯誤消失,這個錯誤我已經檢查了水庫的大寫字母,然後清理了這個項目,但仍然無法擺脫這一點。佈局名稱無法在android
searchBox.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
//get the text in the EditText
String searchString=searchBox.getText().toString();
int textLength=searchString.length();
//clear the initial data set
searchResults.clear();
for(int i=0;i<songsList.size();i++)
{
String playerName=songsList.get(i).get("title").toString();
if(textLength<=playerName.length()){
//compare the String in EditText with Names in the ArrayList
if(searchString.equalsIgnoreCase(playerName.substring(0,textLength)))
Toast.makeText(getApplicationContext(),playerName,1).show();
searchResults.add(songsList.get(i));
}
list.setAdapter(new ArrayAdapter<HashMap<String, String>>
(Home.this,android.R.layout.single_list_item, searchResults));
}
adapter.notifyDataSetChanged();
}
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
}
public void afterTextChanged(Editable s) {
}
});
你的代碼中R.java的包名是什麼? – 2013-02-15 10:01:06
package com.search @ ShailAdi – jack 2013-02-15 10:01:57