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 8459295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:17:48+00:00 2026-06-10T13:17:48+00:00

New to both Android development and Java, trying to separate my queries into query

  • 0

New to both Android development and Java, trying to separate my queries into query / command files which inherit from a database managing QueryBase.java file. When I run my application I get the following error:

08-28 09:31:02.266: I/dalvikvm(536): threadid=1: stack overflow on call to Landroid/database/sqlite/SQLiteOpenHelper;.<init>:VLLLI
08-28 09:31:02.266: I/dalvikvm(536): method requires 32+20+8=60 bytes, fp is 0x432d1318 (24 left)
08-28 09:31:02.266: I/dalvikvm(536): expanding stack end (0x432d1300 to 0x432d1000)
08-28 09:31:02.266: I/dalvikvm(536): Shrank stack (to 0x432d1300, curFrame is 0x432d3eb8)
08-28 09:31:02.266: D/AndroidRuntime(536): Shutting down VM
08-28 09:31:02.266: W/dalvikvm(536): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-28 09:31:02.356: D/dalvikvm(536): GC_FOR_MALLOC freed 4131 objects / 329392 bytes in 47ms
08-28 09:31:02.366: E/AndroidRuntime(536): FATAL EXCEPTION: main
08-28 09:31:02.366: E/AndroidRuntime(536): java.lang.StackOverflowError
08-28 09:31:02.366: E/AndroidRuntime(536): at com.childsoft.icantalk.queries.QueryBase.<init>(QueryBase.java:18)

I’ve never actually run into a stack overflow error before! I’m unsure how to rectify this hrrrm. I have a seperate SchemaHelper which generates my database – working fine. My QueryBase.java looks like this:

public class QueryBase extends SQLiteOpenHelper {

private static final String DATABASE_NAME = "icantalk.db";
private static final int DATABASE_VERSION = 1;

protected SQLiteDatabase sqdb;
protected QueryBase sqh;

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

    this.sqh = new QueryBase(context);
    this.sqdb = sqh.getWritableDatabase();
}

@Override
public void onCreate(SQLiteDatabase db) {           
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}
}

Line 18 on QueryBase is this:

super(context, DATABASE_NAME, null, DATABASE_VERSION);

An example command file that inherits from QueryBase looks like this:

public class ChildCommands extends QueryBase  {

public ChildCommands(Context context) {
    super(context);     
}

public long addChild(String name)
{
    ContentValues cv = new ContentValues();     
    cv.put(ChildrenTable.NAME, name);       
    SQLiteDatabase sd = super.getWritableDatabase();        
    long result = sd.insert(ChildrenTable.TABLE_NAME, ChildrenTable.NAME, cv);

    return result;
}   
}

And an example call on this method would look something like:

private ChildCommands command;
.....

this.command = new ChildCommands(this);
command.addChild(childsNameValue);
  • 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-10T13:17:49+00:00Added an answer on June 10, 2026 at 1:17 pm
    public QueryBase(Context context) { 
        super(context, DATABASE_NAME, null, DATABASE_VERSION);  
    
        this.sqh = new QueryBase(context);
        this.sqdb = sqh.getWritableDatabase();
    }
    

    This results in creating a new object of QueryBase while creating a new object of QueryBase. This is a never ending call.

    Use this:

    public QueryBase(Context context) { 
        super(context, DATABASE_NAME, null, DATABASE_VERSION);  
    
        this.sqh = this;
        this.sqdb = sqh.getWritableDatabase();
    }
    

    Edit: btw sqh is not needed as this variable contains the same instance it is located in (non static!) so sqh == this…

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

Sidebar

Related Questions

Our team is new to both Android and Java development (originally, we came from
I'm new to both Java and Android development so this might be a stupid
I'm new to both android and game development and have been trying to create
I'm relatively new to Android development and Java (learning both simultaneously sort of...). My
I'm rather new to both Java programming and to Android development, so my learning
I am new to Android development. I have both Windows 7 and Mac OS
Just a disclaimer, I'm very new to both android and Java. The end product
Ok, I'm new to android development and am trying to bind to a service
I'm totally new to Android (Java) Development and I'm so excited about it! The
I am new to Android development and am trying to determine if there is

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.