Back to project page ActiveAndroidDemo.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project ActiveAndroidDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gannon.activeandroiddemo; //from w w w .j a v a 2 s.co m import android.app.Application; import android.content.Context; import com.activeandroid.ActiveAndroid; import com.gannon.activeandroiddemo.helpers.ModelHelper; import com.gannon.activeandroiddemo.models.Category; import com.gannon.activeandroiddemo.models.Product; /** * ActiveAndroid Demo Application */ public class ActiveAndroidDemo extends Application { private static Context context; @Override public void onCreate() { super.onCreate(); ActiveAndroid.initialize(this); // init active android on application create context = this; initializeDatabase(); } /** * Initialize database, seed values if empty */ private void initializeDatabase() { if (Category.getAll().size() == 0) { ModelHelper.seedCategories(); } if (Product.getAll().size() == 0) { ModelHelper.seedProducts(); } } /** * Get Application-wide context * @return Context app context */ public static Context getContext() { return context; } }