如何在Android中按列表视图创建收藏夹按钮

时间:2015-03-03 15:15:06

标签: java android android-layout sharepoint-2010

我想为一个模块创建影院应用程序,该模块在列表视图中看起来像是影院大厅,并且有一个收藏夹按钮。当用户单击该收藏夹按钮时,当前列表视图项全部添加到收藏夹列表视图的另一个模块中。

1 个答案:

答案 0 :(得分:0)

首先,您需要学习实现自定义listView。 Here是一个很棒的教程。先这样做。

完成创建适配器和自定义布局后,请执行以下操作:

favoriteButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
              // use sharedPreferences to store small data like strings and ids

              // if your data is big then write it into mysql database
        }
});

共享偏好教程:thisthis

sqlite数据库教程:this& this

当您查看收藏列表视图时,只需从数据库中读取数据并在列表视图中显示