Problem with Quick Search Box: ContentProvider with a custom non-sqlite datasource

by Charlie Chilton » Sat, 03 Jul 2010 15:42:07 GMT


Sponsored Links
 Hi,

I've been trying to implement a quick search feature to my app
Thinking Space this weekend without much success..

I've created a searchable.xml, modified the app's manifest, and
created a 'dummy' content provider. My app doesn't use SQLite for
data, as the searchable objects are MindMaps that are stored in XML
files on the SDCard, so my trouble is with trying to get the Quick
Search system to use my dummy content provider.

My initial goal is just to have the opened map searchable, with the
user's search queries being performed in code against the Java object
model of the currently opened MindMap.

The problem is, that when the using the Quick Search Box, I can see
the search query string arrive at my dummy content provider's query()
method, but the main Activity doesn't get it's onCreate() called with
a search intent; I suspect that this is because the dummy
contentprovider returns Null for the cursor in the query() method, and
then the SearchManager assumes there are no results to bother the
activity with.

Has anyone else had success in utilising the Quick Search
Functionality with non-SQLite datastores? Or should I abandon trying
to use the Quick Search functionality like this, and implement my own
method of doing it?

Any help appreciated!

Thanks

Charlie





--



Other Threads

1. Memory management issues - stop crashing the party!

Ok, first I'm a longtime programmer, but a bit new to the world of
Java (so my apologies in advance).  I've done a bit of searching for
answers or similar questions, but haven't found exactly what I'm
looking for.

In my app, I'm allocating large arrays and experiencing some crashes,
so a few questions on memory management:


1.  Is memory saved in the Dalvik VM by using a short or byte vs. an
integer?  I've read some conflicting things on how this works.  i.e.
-- is the memory occupation as follows:

Byte = 8bits
Short = 16bits
Int = 32bits

2.  Garbage collection strategies.  Specifically, I'm allocating a
couple of large integer arrays in my main activity class.  My program
runs fine once.  When I press the HOME button, however, and then re-
launch the application it crashes when (re)allocating the arrays.

As a way around this, I've declared the large int arrays as "static".
This seems to prevent them from being re-allocated when the app goes
from background to foreground.  Not sure if this is the best strategy
(?)

However, getting past the int[] array HOME button crash, I get a crash
my second run through during some Bitmap activities.  I am doing a
bitmap.recycle() after they are used...but, should large bitmaps be
declared as static also?

How are people working with large arrays and bitmaps that may push the
limits of the VM heap on a single run through the application?

In my experience, pressing the HOME button does not cause garbage
collection of the arrays or bitmaps....yet relaunching the app
attempts to reallocate them both.

So, what's the best approach to dealing with things when you're nearly
at the memory limit -- to allow the app to gracefully go from
foreground/background?

[It would be really great if Google could write an app note on this]

Thanks,
RM
--~--~---------~--~----~------------~-------~--~----~

2. ListView turns black when focused/selected, although I already set cacheColorHint to transparent

Hi there,
first of all, sorry for always complaining about ListView. For
standard tasks it works perfectly, but in my current project, it seems
that I'm just pushing it beyond its limits sometimes, or maybe beyond
the limits of my understanding :)

My list, which contains transparent items, used to turn black on every
scroll, so I followed the instructions on
http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html
This works fine for scrolling, and also looks great when there is no
interaction with the map.

(Before explaining my problem, a note on the wording: Normally I'm
quite sure when to say "focused" and when to say "selected", but when
talking about ListView, I'm always confused which is which. So here's
what I mean: When I use the keyboard/scrollwheel/scrollball to
navigate through the list, and any item is visually highlighted)

When a list item is focused/selected, the whole list turns black
again. As soon as the focus switches to another View outside the
ListView, or as soon as I enter Touch Mode again, the list is redrawn
with perfect transparency.

The whole list also turns black when I press down my finger / mouse
cursor on one item. As soon as I lift my finger, its transparent
again. Also, when I keep my finger pressend, and move it far enough to
initiate scrolling, the list switches to transparent display.

Here's part of my layout.xml:

        <ListView
                android:layout_width="80px"
                android:layout_height="fill_parent"
                android:id="@+id/lvGroups"
                android:layout_marginTop="8px"
                android:layout_marginBottom="8px"
*               android:alwaysDrawnWithCache="true"
                android:cacheColorHint="#00000000"
*               android:scrollingCache="true"
                android:scrollbars="none"
                android:divider="@null"
                android:dividerHeight="0px"
*               android:choiceMode="none"
                android:listSelector="#00000000"
*               android:addStatesFromChildren="false"
*               android:duplicateParentState="true">
        </ListView>

All the attributes which begin with a "*" (of course these "*" are NOT
in my actual file) have something in common: I only partly understand
their meand, I suspect that they might have something to do with the
black-list-problem as well, and I (rather randomly) tried a lot of
different value combinations in order to see if any of them solved the
problem. Maybe I don't even need any of those.

So is there any help for me, to avoid the list being black ever?
--~--~---------~--~----~------------~-------~--~----~

3. ARM Architektur

4. Is there any UI can connect to SQLite database?

5. Widgets ( frequent updates )

6. why my 2nd App replaces the first one?

7. Date AND Time Picker