开发者

Adapter fetches and parses RSS feed to get its data - best practice?

In a shared project, we have an Adapter class (extends BaseAdapter, implements ListAdapter). In its constructor, this class fetches an RSS feed from the internet and parses the returned XML document to obtain the data it will 'adapt'; the data is kept in a private class variable.

This is seen as the "Android way" of doing things by the author and is supported by the project lead.

Can this be considered a "Best Practice"?

Can it be justified on the开发者_开发问答 grounds that it (may?) increase performance?

Doesn't it violate the general Object Oriented Design (OOD) principle that a class should have only a "Single Responsiblity"?

Are best practices for OOD or Java to be set aside in Android development?


You must use an AsyncTask for downloading the feed in the background and have it update the UI in the postExecute step.

You can google for efficient implementation of listadapter which talks about layout inflation and other things.

There are several good talks on Google I/O page if you are interested in general know how about Android's best practices.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜