Project Address: Https://github.com/pardom/ActiveAndroid
The activeandroid is a lightweight ORM framework that allows you to use activeandroid to make the database more quickly censored (without writing SQL statements), and each data record can be manipulated through save () and delete (). So how do we use this framework, I'll write a series of blogs to translate its official documents (maybe a la carte ...). ):
To use Activeandroid, the first to go to the project address that download, and then add it to our project can be used, I believe this step can be completed. After completing this step, we will configure our project and add the following to the Androidmanifest.xml:
<Manifest...> <Application Android:name= "com.activeandroid.app.Application" ...> ... <Meta-data Android:name= "aa_db_name" Android:value= "pickrand.db" /> <Meta-data Android:name= "aa_db_version" Android:value= "5" /> </Application></Manifest>
If your project is in the traditional application class, change it to the following:
Public class MyApplication extends Com.activeandroid.app. Application ...
But if you've already done this with a different library, you can use activeandroid.dispose () in the application class, but if you want to reset the entire frame for debugging, use the following method:
Public class MyApplication extends somelibraryapplication{@Override Public void onCreate() {Super.OnCreate ();activeandroid.Initialize This); }}
In the demo we already have two tables: category and item, so then you should put your class in the table, for example:
@Table (name= "Categories" ) Public class Category extends Model{@Column(name = "Name" ) Public StringName;} @Table (name= "Items" ) Public class Item extends Model{@Column(name = "Name" ) Public StringName@Column(name = "Category" ) Public CategoryCategory;}
The above is our start Oh, if you are interested, please pay attention to the next series ~
GitHub Open Source framework: activeandroid (i)