(Android application source code combined with database shaking 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
Three main interfaces
One add and delete data (long press list to delete)
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.)