Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9101451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:08:07+00:00 2026-06-17T01:08:07+00:00

I have a model class, let’s call it History: public class History { int

  • 0

I have a model class, let’s call it “History”:

public class History {

    int _id;
    String _file_name;
    String _full_path;
    String _file_type;

    public History(){
    }

    public History(int id, String _name, String _full_path, String _file_type){
        this._id = id;
        this._file_name = _name;
        this._full_path = _full_path;

 this._file_type = _file_type;

}
public int get_id() {
    return _id;
}
public void set_id(int _id) {
    this._id = _id;
}
public String get_file_name() {
    return _file_name;
}
public void set_file_name(String _file_name) {
    this._file_name = _file_name;
}
public String get_full_path() {
    return _full_path;
}
public void set_full_path(String _full_path) {
    this._full_path = _full_path;
}
public String get_file_type() {
    return _file_type;
}
public void set_file_type(String _file_type) {
    this._file_type = _file_type;
}

}

I’d like to auto-generate a Database Handler for all of my models that looks similar to this:

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHandler extends SQLiteOpenHelper {

    private static final int DATABASE_VERSION = 1;

    private static final String DATABASE_NAME = "file_explorer";

    private static final String TABLE_HISTORY = "history";

    private static final String KEY_ID = "id";
    private static final String KEY_NAME = "name";
    private static final String KEY_PH_NO = "phone_number";

    public DatabaseHandler(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_HISTORY + "("
                + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
                + KEY_PH_NO + " TEXT" + ")";
        db.execSQL(CREATE_CONTACTS_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_HISTORY);
        onCreate(db);
    }
}

(This isn’t a handler for my model, but you get the idea)

Is this possible or do I have to manually create a database handler for each model?

I checked Eclipse’s auto generation options but I didn’t find what I need.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:08:08+00:00Added an answer on June 17, 2026 at 1:08 am

    Take a look at this SO question: Any good ORM tools for Android development?

    Although I would probably go with ORMLite for Android. Examples for use are on the site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a model class, public class NameModel { public string Title
Let's say you have this Model: //model public class Stuff { public string Name
Let's have a model public class Model { public int Number { get; set;
Let's say I have some model objects that resemble this: public class FooModel {
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have a model: public class Attribute { public int Id { get; set;
Let's say I have the following two classes: package example.model; public class Model {
I have the following model: public class Person { public string Name { get;
Let's say I have the model public class ViewModel { [Required] [Display(Name = Email
Here is my problem: I have an array of model class(Let's say, 'addressModel' with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.