的EndlessAdapter在使用EndlessAdapter,我碰到這個錯誤傳來:錯誤而使用的Android
在這下面的語句無法實例類型EndlessAdapter:
EndlessAdapter adapter = new EndlessAdapter(this);
我在EndlessAdapter定義的適配器類.java並導入它。
這是我的全部代碼:
package com.example.litest;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.example.utilities.TestListAdapter;
import com.example.utilities.EndlessAdapter;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class ListActivity extends Activity{
public final static String ITEM_TITLE = "title";
public final static String ITEM_CAPTION = "caption";
public Map<String,?> createItem(String title, String caption) {
Map<String,String> item = new HashMap<String,String>();
item.put(ITEM_TITLE, title);
item.put(ITEM_CAPTION, caption);
return item;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
List<Map<String,?>> security = new LinkedList<Map<String,?>>();
security.add(createItem("Remember passwords", "Save usernames and passwords for Web sites"));
security.add(createItem("Clear passwords", "Save usernames aznd passwords for Web sites"));
security.add(createItem("Show security warnings", "Show warning if there is a problem with a site's security"));
for(int n=10; n>0; n--)
security.add(createItem("Clear passwords", "Save usernames and passwords for Web sites"));
// create our list and custom adapter
EndlessAdapter adapter = new EndlessAdapter(this)
//adapter.addSection("Security", new EndlessAdapter(this, security, R.layout.list_complex,new String[] { ITEM_TITLE, ITEM_CAPTION }, new int[] { R.id.list_complex_title, R.id.list_complex_caption }));
ListView list = new ListView(this);
list.setAdapter(adapter);
this.setContentView(list);
}
}
的logcat:http://pastebin.com/2WnnJ9KA
發表了日誌貓。檢查! – Hick 2012-01-12 07:37:25