0
我已經創建了四個帶有listview的標籤。我一直在嘗試使列表視圖可點擊,我用Here列表視圖教程創建列表視圖使用string.xml和R.array:佈局錯誤無法解決
問題是當我使用我的意圖和onItemClickListener我得到多個標記錯誤,如果我玩弄逗號括號和類身標記錯誤四處移動,那麼它的語法是問題,還是代碼的佈局或位置;
public class ll2 extends ListActivity {
static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String[] TEAMS = getResources().getStringArray(R.array.twoteams_array);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, TEAMS));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
public void onListItemClick(ListView, parent, View v, int position, long id);
}
if (position == "Braford City") {
Intent intent = new Intent(this, Bradford.class);
startActivity(intent);
}
}
我這裏得到這些錯誤:
static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};
語法錯誤,插入 「}」 來完成 ClassBody
如果我完成添加類的身體我得到更多的誤差修改這裏和其他地方。
我這裏得到這些錯誤:
public void onListItemClick(ListView, parent, View v, int position, long id); }
Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error, insert ";" to complete LocalVariableDeclarationStatement - Syntax error on token ",", ; expected - Syntax error on token "(", = expected - Syntax error on token ",", ; expected - Syntax error, insert "}" to complete MethodBody - Syntax error, insert "}" to complete ClassBody - Syntax error on token "}", delete this token這裏
同樣的問題我已經嘗試了不同的組合,它不斷給我的錯誤與此設置我有錯誤
任何幫助最少的非常感謝
感謝ü這麼多,我想b是出第一個承認嵌入struggledwith這一點,但在這個問題上綁架些小與O問題後代碼你給我終於設法得到它的工作天才克里斯....天才 – JonniBravo 2010-09-25 16:11:20
Ps拼寫是我的手機預測文字9個問題我的意思 – JonniBravo 2010-09-25 16:12:48