je suis entrain de développer mon application qui permet de parser les données à partir d'un fichier XML et l'afficher sous une listview.

l'erreur : "the constructeur SimpleAdapter is undefined "
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 // Adding menuItems to ListView
				ListAdapter adapter = new SimpleAdapter(this, menuItems,R.layout.item_detail_accueil,
						new String[] { KEY_TITLE, KEY_CONTENT, KEY_TEASER }, new int[] {
								R.id.title, R.id.teaser, R.id.content });
voila toute la classe

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
 
package com.android.SAXParser;
 
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
 
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
 
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
 
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleAdapter;
import android.widget.Toast;
 
public class SAXParserActivity extends  ListActivity{
 
	XMLGettersSetters data;
 
	protected ProgressDialog ProgressDialog;
	private Runnable albumsRunnable;
	//TextView title,link,teaser,content,sound,photo,date;
 
	static final String KEY_ARTICLE = "article"; // parent node
	static final String KEY_TITLE = "title";
	static final String KEY_LINK = "link";
	static final String KEY_TEASER = "teaser";
	static final String KEY_CONTENT = "content";
	static final String KEY_SOUND = "sound";
	static final String KEY_photo = "photo";
	static final String KEY_date = "date";
 
	ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
 
 
 
		 albumsRunnable = new Runnable()
		  {
		   public void run() 
		   {
 
 
		    getData();
 
		   }
		  };
 
 
		  Thread thread = new Thread(null, albumsRunnable, "GetAlbumsThread");
		  // Start the thread
		  thread.start();
 
		  // Display progress dialog
		  ProgressDialog = ProgressDialog.show(this, null, "waiting", true);
	}
 
 
	 private void getData()
	{
		   boolean error = false;
 
 
				try {
 
					/**
                                         * Create a new instance of the SAX parser
                                         **/
					SAXParserFactory saxPF = SAXParserFactory.newInstance();
					SAXParser saxP = saxPF.newSAXParser();
					XMLReader xmlR = saxP.getXMLReader();
 
 
					URL url = new URL("http://www.mosaiquefm.net/smart/newscast.xml?Cat=4"); // URL of the XML
 
					/** 
                                         * Create the Handler to handle each of the XML tags. 
                                         **/
					XMLHandler myXMLHandler = new XMLHandler();
					xmlR.setContentHandler(myXMLHandler);
					xmlR.parse(new InputSource(url.openStream()));
 
				} catch (Exception e) {
					System.out.println(e);
				}
 
				data = XMLHandler.data;
 
 
		    if (data == null)
		    {
		     error = true;
		    }
 
		   if (error == false)
		   {
		    runOnUiThread(albumsResultRunnable);
		   }
		   else
		   {
		    runOnUiThread(returnNullResourceRunnable);
		   }
		  }
 
  private Runnable albumsResultRunnable = new Runnable()
		  {
		   public void run()
		   {
			    if (ProgressDialog.isShowing())
			    {
			    	ProgressDialog.dismiss();
			    }
			   // Toast.makeText(SAXParserActivity.this, data.getTitle().get(0), Toast.LENGTH_LONG).show();
 
			    for (int i = 0; i < data.getTitle().size(); i++) {
					// creating new HashMap
 
					HashMap<String, String> map = new HashMap<String, String>();
 
					// adding each child node to HashMap key => value
					map.put(KEY_TITLE, data.getTitle().get(i));
					map.put(KEY_CONTENT, data.getContent().get(i));
					map.put(KEY_TEASER, "Rs." + data.getTeaser().get(i));
				//	map.put(KEY_DESC, parser.getValue(e, KEY_DESC));
 
					// adding HashList to ArrayList
					menuItems.add(map);
				}
			 // Adding menuItems to ListView
				ListAdapter adapter = new SimpleAdapter(this, menuItems,R.layout.item_detail_accueil,
						new String[] { KEY_TITLE, KEY_CONTENT, KEY_TEASER }, new int[] {
								R.id.title, R.id.teaser, R.id.content });
 
				setListAdapter(adapter);
 
 
		   }
 
		  };
 
		  private Runnable returnNullResourceRunnable = new Runnable()
		  {
		   public void run()
		   {
		    if (ProgressDialog.isShowing())
		    {
		    	ProgressDialog.dismiss();
		    }
		   Toast.makeText(SAXParserActivity.this, "Erreur", Toast.LENGTH_LONG).show();
 
 
		   }
		  };
 
 
}