안녕하세요,이 SimpleAdapter를 ListView에 일부 알림을 표시하기 위해 사용하고 있습니다. 이러한 알림은 ArrayList
localist에 있습니다.Android : SimpleAdapter 오류
SimpleAdapter adapter = new SimpleAdapter(this,localist, R.layout.rss_list_item,new String[] {"title","pubDate"},new int[] {R.id.title, R.id.pubDate });
final ListView lv = (ListView) findViewById(android.R.id.list);
lv.setAdapter(adapter);
것은 그것이 나에게 첫 번째는 localist에있다 나가요 세 가지 오류를 표시하고 "localist이 변수에 해결 될 수 없다"라는 것입니다 : 여기에 코드입니다.
두 번째 및 세 번째이다
lv.setAdapter(adapter);
라는 점에서 하나의 "토큰은, 잘못 구조체 (들)에 대한 구문 오류"와 괄호 그 내부 어댑터에서 다른에서 "토큰 구문 오류", "이 토큰 다음에 VariableDeclaratorId가 필요합니다." 두 번째 오류와 세 번째 오류는 첫 번째 오류 때문에 발생합니다. 이 문제를 해결하는 방법에 대해 아이디어가 있습니까?
편집 : 귀하의 의견에서
protected Integer doInBackground(Void... params) {
ArrayList<HashMap<String, String>> localist = new ArrayList<HashMap<String, String>>();
String xml = ParseXMLmethods.getXML();
Document doc = ParseXMLmethods.XMLfromString(xml);
if (doc != null) {
NodeList children = doc.getElementsByTagName("item");
ZERO_FLAG = false;
if (children.getLength() == 0) {
ZERO_FLAG = true;
publishProgress();
}
for (int i = 0; i < children.getLength(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
Element e = (Element) children.item(i);
map.put("title", ParseXMLmethods.getValue(e, "title"));
map.put("pubDate", ParseXMLmethods.getValue(e, "pubDate"));
map.put("link", ParseXMLmethods.getValue(e, "link"));
map.put("description",ParseXMLmethods.getValue(e, "description"));
localist.add(map);
}
더 많은 코드를 보여주세요. 지역 주의자를 어디에서 정의하고 만드나요? – SimonSays
@ SimonSays here go – SoCo
이 사이트는'localist'를 사용하려고하는 유일한 장소입니까? – codeMagic