explaingit

pardom-zz/activeandroid

4,658JavaAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

ActiveAndroid is a Java library for Android that lets you store and retrieve database records by calling methods on plain Java objects, no SQL required. It handles setup, migrations, and queries so your app code stays clean and focused on data.

Mindmap

mindmap
  root((repo))
    What it does
      Save records with save()
      Delete with delete()
      Query without SQL
    Tech Stack
      Java
      Android
      SQLite
      Gradle or Maven
    Features
      Schema migrations
      Custom type support
      Content providers
      Pre-populated DB
    Audience
      Android developers
      Mobile app builders
    License
      Apache 2.0
      Commercial allowed
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build an Android app that saves user data locally without writing any SQL code

USE CASE 2

Manage a local database in an Android app with automatic schema migration when the data structure changes

USE CASE 3

Ship an Android app with a pre-filled database of content that loads on first run

USE CASE 4

Replace Android's verbose SQLite setup code with simple Java objects that save and delete themselves

Tech stack

JavaAndroidSQLiteGradleMaven

Getting it running

Difficulty · easy Time to first run · 30min

Add the Gradle or Maven dependency, initialize in your Application class, and annotate your model classes. No SQL setup needed.

Apache 2.0, free to use in personal and commercial projects. You can modify and distribute it as long as you include the license notice.

In plain English

ActiveAndroid is a Java library for Android apps that handles storing and retrieving data from a local database without requiring you to write SQL. It follows a pattern called Active Record, where each row in a database table is represented as a Java object. You call methods like save() and delete() directly on those objects, and the library translates those calls into the correct database operations for you. The library is aimed at Android developers who find working with SQLite directly to be cumbersome. Android's built-in database tools require a fair amount of setup code, and raw SQL can be error-prone to write and maintain. ActiveAndroid handles the configuration and low-level details so that the application code stays focused on the data itself rather than on how to store it. Features described in the wiki include creating database models, saving and querying records, handling custom data types through type serializers, using Android's content provider system, managing schema migrations as the database structure changes over time, and loading a pre-populated database that ships with the app. The library is added to an Android project through Maven or Gradle using the package com.michaelpardo:activeandroid. It is released under the Apache 2.0 open-source license, which allows use in both personal and commercial projects. The project was created by Michael Pardo, and contributions in the form of pull requests are accepted after review.

Copy-paste prompts

Prompt 1
I'm using the ActiveAndroid library (com.michaelpardo:activeandroid) in my Android app. Show me how to create a Model class for a Task with a title and due date, then save and query tasks.
Prompt 2
Using ActiveAndroid for Android, how do I write a query to find all records where a field matches a value, without writing raw SQL?
Prompt 3
I need to add a new column to an existing ActiveAndroid table in my Android app without losing user data. How do I write a migration for this schema change?
Prompt 4
How do I set up a pre-populated SQLite database with ActiveAndroid so my Android app ships with existing data on first install?
Prompt 5
Using ActiveAndroid, how do I create a custom TypeSerializer to store and retrieve a Java enum in the SQLite database?
Open on GitHub → Explain another repo

← pardom-zz on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.