找回密码
 立即注册
android开发 2022-05-22 113 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
android应用源码结合数据库进行摇一摇的小实例
1. 功能说明 这是我和小伙伴们每天在学校为了吃什么而苦苦挣扎完成的demo。这个想法的最初来源是俱乐部里的其他朋友。
现在可以做的功能是输入和删除各种食物选择,然后摇出其中一个作为选择。
该demo主要包含两个功能:数据库的增删改查和摇一摇的实现(大部分核心代码来自EOE大家,谢谢)

二 文件说明

DBAdapter.java - 数据库工具类
Food.java - 食品类及其属性(id 和内容)
MainActivity.java - 数据库增删活动
MyApplication.java - 用于整体退出的工具类,聚合了所有Acitivity
ShakActivity.java - 摇动活动
ShakeListener.java - 一个实现 SensorEventListener 接口的摇动工具类

两次点击左键显示摇动菜单选项进入摇动界面

四次分享与提问
     分享:细节带给用户良好的体验。例如:
TextView 接受用户添加后自动清空;
ListView 添加的最新数据在视野内自动可见(设置 android:stackFromBottom="true";
                                                               android:transcriptMode=“alwaysScroll”)

     尚未解决的问题:
  菜单的排列现在总是垂直的;
  当表中的数据为空时,shake函数存在bug。

(Android application source code combined with the database to shake a small example
1. Function description this is a demo of what my friends and I struggle to eat at school every day. The original source of this idea was other friends in the club.
What you can do now is to input and delete various food choices, and then shake one of them as a choice.
The demo mainly includes two functions: the addition, deletion, modification and query of the database and the implementation of shaking (most of the core code comes from EOE, thank you)
II. Document description
DBAdapter. Java - database tool class
Food. Java - food class and its attributes (ID and content)
MainActivity. Java - database addition and deletion activities
MyApplication. Java - a tool class for overall exit, which aggregates all acitivities
ShakActivity. Java - shake activity
ShakeListener. Java - a shaking tool class that implements the sensoreventlistener interface
Click the left button twice to display the shaking menu option and enter the shaking interface
Four sharing and questions
Sharing: details bring users a good experience. For example:
Textview will be automatically cleared after being added by the user;
The latest data added by listview is automatically visible in the field of view (set Android: stackfrombottom = & quot; true & quot;;
android:transcriptMode=“alwaysScroll”)
Unresolved issues:
The menu arrangement is now always vertical;
When the data in the table is empty, there is a bug in the shake function.)

[下载]15462257982.rar




上一篇:android应用源码基于讯飞语音的中文语音合成
下一篇:android应用源码界面切换动画大全