我正在为Android编写RSS阅读器.我遇到了一些难以解决的问题,因为数据库不是我的专业知识,所以我无法解决这个问题.所以我想你也许其中一个可以帮助我!我目前有3个表(类别,链接和提要).我的目标是将Feed添加到多个类别.因此我使用的是Link表.我的数据库是Android ContentProvider(sqlite),如下所示:
| Categories | | Links | | Feeds |
|------------| |---------| |-------|
| _ID | | Category| | _ID |
| Title | | Feed | | Title |
| URL |
Run Code Online (Sandbox Code Playgroud)
我目前在FeedListActivity中编写了以下代码,以检索链接及其提要列表.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//gets the intent URI to retrieve the Feeds.
Intent intent = getIntent();
if (intent.getData() == null) {
intent.setData(Feeds.CONTENT_URI);
}
// stores the Category id so it knows from what category it came from
mCatId = intent.getIntExtra("catId", -1);
getListView().setOnCreateContextMenuListener(this);
// …Run Code Online (Sandbox Code Playgroud)