我正在尝试使用Retrofit下载XML数据并使用Simple解析它,然后将其加载到ListView中.
不幸的是,下载的数据不会出现在屏幕上 有人能告诉我问题出在哪里吗?
这是我的模特:
@Root(name = "item")
public class Article {
@Element(name = "title")
private String title;
@Element(name = "author")
private String author;
@Element(name = "description")
private String description;
Run Code Online (Sandbox Code Playgroud)
接口代码:
public interface Service {
@GET("/rss/news")
public void getArticle(Callback<List<Article>> callback);
}
Run Code Online (Sandbox Code Playgroud)
片段代码:
public class ArticlePreviewFragment extends Fragment {
protected ArticlePreviewAdapter adapter;
protected List<Article> previewList;
private ListView listView;
public ArticlePreviewFragment() {}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
previewList = new ArrayList<>();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) …Run Code Online (Sandbox Code Playgroud)