GitHub Open Source framework: activeandroid (i)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.