Android :: Using COLLATE In SQLite - Locales Is Ignored In LIKE Statement
Aug 13, 2010
When creating my SQLite database in Android I set the database locale - db.setLocale(new Locale("cz_CZ")). This is a Czech locale. A SELECT statement works and takes the locale into account, for example:
SELECT * from table WHERE name='sctzy' COLLATE LOCALIZED
But using LIKE will fail: SELECT * from table WHERE name LIKE '%sctzy%' COLLATE LOCALIZED
BTW. There is no java.text.Normalized class in Android. I thought I could make a second column with a normalized text, stripped of special characters, which would be used for searching - but I am missing a class or way how to normalize the String.
View 1 Replies
Jul 23, 2010
I'm developing an application that tracks the user's current position and stores it into a SQLite database. Everything works fine, but now I have the problem when querying the database for a track with more than 1000 records it takes nearly 1.5 minutes. On my Desktop it just takes 1 second. I know it's a query with many subselects but I wasn't able to get the right result another way. In my opinion this belongs to the aggregate functions like avg() and sum().
Here's my query:.................
View 3 Replies
View Related
Mar 23, 2010
I have a query that selects rows in a ListView without having a limit. But now that i have implemented a SharedPreferences that the user can select how much rows will be displayed in the ListView, my SQLite query doesnt work. Im passing the argument this way:
CODE:...................
View 1 Replies
View Related
Apr 25, 2009
Anyone working with big sqlite tables and trying to match rows using patterns (for example for autocomplete purposes) ? recently i played with LIKE statement and it seems it will never use table index (if any), you have to use GLOB instead. but....... the weird thing is that you cannot use selectionParams in your query: you have to specify your pattern in selection like:
CODE:........
My words table has two TEXT columns: 'key' and 'value' and index on 'key'
For example: i have table with ~28000 rows and when using selectionParams my query took 1500 ms and without selectionParams 20 ms does it have anything to do with android or its sqlite weird feature?
View 2 Replies
View Related
May 8, 2010
I am trying to update a datetime column in an android sqlite db to use international date format (yyyy-mm-dd) instead of the current format (mm/dd/yyyy). I want to use the sqlite date() function to reformat the current value of the column. I thought it would be as simple as the following: update tblename set thedate = date(thedate)
But the above does not work.
How would i write the sql statement to accomplish this?
View 1 Replies
View Related
May 11, 2012
I'm trying to select the items that have a expiration date >= that an selected date.I'm using the format yyyy-mm-dd, and this is my sql statement:
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date(finalDate) >= date("+selectedDate+")";
This query always result a "full select" in my database, as if there were no conditions.Some useful information:
selectDate is a String which have a date in yyyy-mm-dd format
I'm executing the query like this:
return db.rawQuery(sql,null);
View 3 Replies
View Related
Oct 28, 2009
For my application, I am trying to add entries without having a duplicate entry, and if there are a duplicate notify the user and have him try again. Using SQLite, which I know very very little about, I have tried these two ways and want to know which one is better, more efficient or a better way to develop it? First way:
db.execSQL("INSERT INTO " + DatabaseHelper.DATABASE_TABLE +
"(LATITUDE, LONGITUDE, RATING) SELECT " + latitude + ", " + longitude + ", " + rating +
" WHERE NOT EXISTS (SELECT 1 FROM " + DatabaseHelper.DATABASE_TABLE +
" WHERE LATITUDE = " + latitude + " AND LONGITUDE = " + longitude + ")");
Second way:
long id = -1;
try { id = db.compileStatement(
"SELECT COUNT(*) FROM " + DatabaseHelper.DATABASE_TABLE
+ " WHERE LATITUDE = " + latitude
+ " AND LONGITUDE = " + longitude)
.simpleQueryForLong();
} catch (NullPointerException e) { return -1;
} return id;
The first way, either inserts or ignores the values, I check by doing so, storing the row-count of the rows into a variable before the call, call that function, and then check its results. If the results is not higher than it was before the call, the insert was made ignored, prompt the user with the 'values exist' message. (Very sloppy, I know but desperate times calls for desperate measures). The second way, returns the actual count of rows that match the numbers I want to store, if the number returned greater than 1, prompt the user with the 'values exist' message. I have been going back and forth, trying different ways but I do not know how to set up SQLite to have UNIQUE pairs, which I was told would be the easiest.
View 3 Replies
View Related
Aug 8, 2010
I have a database with tables called box, item, and box_contents and I want to get any item that is contained in the box_content table (all items, but discard the ones that arent in the box_contents table). What would be the correct sqllite syntax for this?
View 2 Replies
View Related
Sep 25, 2010
I have a table called "images":
CODE:.........
On inserting a row, I'd like the URL column to be unique. At the same time, I'd like to find out the id of the row with that URL.
INSERT OR IGNORE images (url, caption) VALUES ("http://stackoverflow.com", "A logo"); SELECT last_insert_rowid(); -- returns the id iff there was an insert.
Of course, I'd like to do it as quickly as possible, though my first thought was along the the lines of the following pseudo code:
CODE:...........
But this seems hopelessly inefficient.
What is the most performant way of getting the Auto incremented row id from an INSERT OR IGNORE statement.
View 1 Replies
View Related
Aug 30, 2010
In my application, I need to display strings according to user locale selection. So, I put my strings.xml in values-en, values-ko, etc. How can I set locale us, Australia i.e; values-en_US, values-en_AU? But it's throwing an error? Can any one tell me how to set these locales in my code?
View 3 Replies
View Related
Nov 16, 2010
What is the difference between locales ja and ja_JP in Android? Do I have to care about both?
View 1 Replies
View Related
Sep 24, 2010
We need to test the emulator in Swedish but the language option isn't available in the emulator. I can see that the language files are available for Swedish and many other languages under android-sdk-windowsplatformsandroid-8data
es
Is there anyway I can force the emulator to use Swedish?
View 2 Replies
View Related
Apr 28, 2010
I want to translate my app into all available markets. code...
However, look at http://developer.android.com/reference/java/util/Locale.html
it lacks : polish pl_PL and nl_NL
Now what I'm doing is creating values-fr values-es directories. But my phone only has English and Spanish locales.
Here's two things that would help:
1. A definitive list of all locale suffixes that are allowable as the values-?? directory names 2. A way to add more locales to my phone.
View 3 Replies
View Related
Jun 25, 2010
Been using Galaxo 1.6.3.3 for quite some time now and it's fast, stable and tweakable. Only thing that lacks is the support of Dutch locales. Tried the app MoreLocale 2 however this only changes the language of the homescreen menu. Settings e.g. remain English. In XXJC2 Dutch locales are included so I was wondering if it's possible to copy them to Galaxo 1.6.3.3. Anyone knows how to do this? Seems like some Tai managed to install Tai fonds by replacing Sans Droid in system/fonts. Don't think this adds languages though.
View 2 Replies
View Related
Apr 11, 2012
How to find list of SYSTEM LOCALES (language list that we see in settings) from ROM file system image/file tree (assuming that /system can be mounted as folder)? Which files/folders have this information?
View 5 Replies
View Related
Feb 16, 2010
I have a strange issue. I am new to java/android but come from a programming background maybe I am just missing or doing something stupid with syntax here. I have a string variable called reportlength
String reportlength;
I then go: reportlength = intent.getExtras().getString("ReportLengt");
Now in my debug console for the variable reportlength it has it set as "d" (that is the correct value it should have)
At this point I have my if statement:
CODE:......................
View 3 Replies
View Related
Jul 20, 2010
So I've got this code (updated for solution).
CODE:.............
The problem I was having was that one of the TextViews would turn grey when it wasn't supposed to. I tried fixing it by always setting the text to black again, but that turned every single one of them grey.
Until I tried:
CODE:................
Don't know why the latter works when setting text grey, but there it is. I guess I'm just a little retarded.
View 7 Replies
View Related
Jan 26, 2010
How can I enable assert statement on Android? I have referred to a url: http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=d... and done what it said: adb shell setprop dalvik.vm.enableassertions all but nothing happen! The test code is: Log.v("assert 1","1"); assert false; Log.v("assert 2","2"); No matter what I did, "assert 2" will be printed, which means "assert false" does nothing! What should I do? BTW, I use eclipse as IDE.
View 7 Replies
View Related
Sep 27, 2010
I'm trying to reduce the number of queries I do to the Android's database. Basically I want to get any email or IM address that contains a user defined search term. Right now I'm doing two separate queries:
Email:...............
View 3 Replies
View Related
Mar 1, 2010
I know the error will probably be painfully obvious to you but using cursor.getCount() on the result of the following returns a 0 when there are multiple items in the table and trips the error "Invalid statement in fillWindow()".
CODE:...............
View 3 Replies
View Related
Jul 15, 2010
CODE:...........................
View 1 Replies
View Related
Jul 28, 2010
I'm getting unexpected behavior in my Android 1.5 application under the Windows emulator and debugging with Eclipse. Here's a generalization of what the code is doing:
if (someCondition) {
System.out.println("got here");
return "a";
}
if (someOtherCondition)....................
View 2 Replies
View Related
Aug 25, 2010
I have a central activity that can be launched from two separate classes. I was hoping that in this central activity I could have an IF statement like
if(this.getIntent() == MainMenu.class)
{
// Do something here
}
But obviously that isn't legal so how could I structure an expression to check from what class an intent was started.
View 2 Replies
View Related
Nov 16, 2010
i sometimes see this error in my logcat output, Cursor: invalid statement in fillWindow(). it sometimes happens when i press the back key and then it goes to the default android listview before going to my custom listview. what does it mean? how do i solve it? Because it does not point to any line of code where the problem is coming from?
View 1 Replies
View Related
Aug 1, 2010
Does anyone have a statement released from Google or someone within Google telling the consumers to avoid Task Managers on Android devices.I went into VZW, trying to get an additional battery (usually if u complain they send u an additional battery) because I'm getting 5-7 hours out of my battery even when I'm careful and try to stretch my battery. So the women asked questions, do u use Wifi...NEVER, don't even turn it on. Brightness? It's 1/8th of the way on to full brightness, Task manager?No Google said not to use one..So she wouldn't send me a battery because she said that its because I don't use a task manager.I was telling her Google had advised us not to and she said, that's false that Google has approved them to put task managers on people's phones who are having battery problems.(I don't believe that)I looked around Google and could only find it from joe-shomes but couldn't find a statement from Google. Can anyone provide a statement from Google that advises us not to use task managers?
View 6 Replies
View Related
Nov 2, 2010
I cannot figure out why I can't get this method to enter the if statement.
CODE:.........
Note that the log and debug mode shows that "start = 0"
I also tried
if (start == 0l) {
if (start == 0L) {
What the heck am I missing here? Does 0 != 0?
I'm developing in Eclipse with Java for Android. Thanks.
@methodin - no sorry, that does not work.
@Aioobe - I have a breakpoint under the IF statement, that never gets made.
Here is the actual code I'm running since you've asked.
CODE:................
View 4 Replies
View Related
Nov 7, 2010
I need some help with switch/case statement syntax. im trying to use onClick to have different buttons do different things. i have the first one working. it just uses an intent to start a new activity. for the next button, i want it to open a specific url looks like this so far
CODE:..............
How do i get the engadget_button to open engadget.com?
Is it just something like this:
CODE:....................
View 1 Replies
View Related
Jul 29, 2010
I got problem with register. I use an if-else statement to check whether the user left any blank. If there is any blank, an error message will appear. The problem is, even with no blanks, all filled up, the error message still appears and thus prevents user from registering. I can't find any error.
Please help me spot my error.
CODE:..................
View 2 Replies
View Related
Oct 15, 2010
CODE:............................
View 3 Replies
View Related
May 26, 2010
How do I make the Java assert statement work? By "work" I mean that a failed assertion should either stop program execution or at least log the failure. Currently, neither happens. I understand there is a run- time option to enable this (-ea), but I don't know where to specify it. Changing "PreferencesJavaInstalled JREsEdit JREDefault VM Arguments" has no effect, probably because those settings are not used for the Android execution.
View 5 Replies
View Related