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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:41:37+00:00 2026-06-15T11:41:37+00:00

I need to create a SQLite DB for my application. I’ll need to store

  • 0

I need to create a SQLite DB for my application. I’ll need to store text in several European languages, so there will be plenty of accented characters and other weird marks. I’m extending SQLiteOpenHelper.

Inspecting the .db file I noticed there’s an extra table named android_metadata. There’s a single column named locale, which is set to “en_US” by default in my simulator.

I’ve readed the SQLite section in the developer guide, and also the javadocs for SQLiteOpenHelper and SQLiteDatabase, searched in SO and in Google, but nowhere I could find what is the correct place to set the locale to the DB, or if it is really neccesary. Guessing it should be done at DB creation, I tried calling db.setLocale in the helper’s onCreate method, but I’m, getting this exception:

BEGIN TRANSACTION failed setting locale
FATAL EXCEPTION: Thread-9
android.database.sqlite.SQLiteException: cannot start a transaction within a transaction
at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1950)

This is how my method looks:

public class MyOpenHelper extends SQLiteOpenHelper {

    @Override
    public void onCreate(SQLiteDatabase db) {   
        db.setLocale(new Locale("en","EN"));
        ...
    }

    ...
}

And here are my questions:

  1. Do I really need to set the locale to the DB? I don’t really need to get the queries sorted out of the box, as I can always sort the results myself later.
  2. Where should I call setLocale?
  • 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-15T11:41:39+00:00Added an answer on June 15, 2026 at 11:41 am
    1. You’ll need to set the locale only if you intend to use the LOCALIZED collation algorithm, which depends on the system locale,
    2. As mentioned in your answer, call setLocale() on onConfigure().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is an application that need to create several tables in DB. I wrote
I need to create JSON from Sqlite database in a iphone application. I have
I am developing small application in PHP that will need to store small number
I'm creating an android application in which i will need to store data using
I need to create a complex SQLite statement. I need a SQLite statement like
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
Need to create a custom DNS name server using C which will check against
I need to create a WP site which will have multiple subjects. Each subject
I am working on a contact list application I need to create 2 tables
I am writing a PHP application targeted at non-geeks, non-programmers. I need to create

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.