安卓:实现在列表视图中的收藏夹 [英] Android: Implement favorites in list view

查看:269
本文介绍了安卓:实现在列表视图中的收藏夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的应用程序是关于地方用户可以看到的地方名单接近他的位置,并认为,地方的详细目录。

My app is about a directory of places where a user can see list of places close to his location and view details of that place.

我要添加到我的收藏夹功能,在列表视图和详细信息页面视图中的所有项目。

I want to "add to my favorites" functionality for all the items in list view and detail page view.

什么是做到这一点的最好方法是什么?我想这样做使用复选框,但无法理解如何在列表视图的适配器实现。

What is the best way to do this? I was thinking to do it using CheckBox but was not able to understand how to implement in listview adapter.

我想下表straucture的收藏夹中: _id - 整数主键 content_identifier - 为地方(文本)的唯一标识符

I am thinking of the following table straucture for favorites: _id - integer primary key content_identifier - unique identifier for the place (text)

有人可以帮忙吗?

问候, 萨班

推荐答案

创建自定义列表视图(要了解如何创建自定义列表视图,并添加监听器吧)
并添加一个复选框或图像,添加一个侦听器(点击监听器)的列表项,当图像或复选框是pressed的图像,添加数据库条目(收藏表左右)

Create a custom listview(check how to create a custom listview and add listeners to it)
and add a checkbox or an image , add a listener(click listener) to the image of the list items, whenever image or checkbox is pressed , add a database entry ( favorites table or so)

这篇关于安卓:实现在列表视图中的收藏夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆