我需要Asynctask
和自定义适配器的帮助。
我有一个asynctask
通过解析获取数据。然后我必须将它们放在ListView
中。
我创建了一个自定义适配器,但我对上下文有一些问题。我确信这有一个非常简单的解决方案,但我无法理解实际上下文是什么!
eclipse中说明了这个问题:
protected void onPostExecute(final List<String> list) {
ListView listView = (ListView)findViewById(R.id.listavvisi);
CustomAdapter adapter = new CustomAdapter(**this**, R.layout.rowcustom, list);
listView.setAdapter(adapter);
我将列表传递给customadapter
public class CustomAdapter extends ArrayAdapter<Avviso> {
private Context context;
public CustomAdapter(**Context** **context**, int textViewResourceId, List<Avviso> Strings) {
super(context, textViewResourceId, Strings);
}
调用New Customadapter...
时我需要什么上下文?
答案 0 :(得分:1)
我回答我自己的问题。 所以,我不得不使用“javaclass.this”而不是“context”