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

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!




Other Threads

1. Application without main activity

Is there a way to manage application activities by hand, like this:
user activating an application from menu, it does some initialization,
then creates some activity (is it necessar y to declare all activities
in the application manifest?), and listens to it's events. On some
event application decides to close one activity and open another - so
it contains all the application logic.
Didn't found anything like this in examples, they all have all the
logic in the activity classes.
Maybe I need to user Services?
(Maybe I don't understand right, what an activity represents. For me
it's like window in windows, or Displayable in j2me)

I'm very new to android development, trying to understand the basics.


2. Listview problems

Hi All,

Struggling and struggling, but can't find the thing i'm doin wrong in my
listview implementation. No exceptions, just no listview. I have a
customized adapter with an overridden getView method, but the Log.d won't
show, so i guess my adapter is just wrong? Could somebody have a look at the
code below? Thanks in advance!


public class ArticleList extends ListActivity {

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        // call super constructor

        // set the layout used for this activity

        // create a new splashscreen and show it:
        SplashScreen ss = new SplashScreen(this);;

        // now that we have the splash screen displayed fire up the
        // method that's going to fetch our content
        ArticleListView alv = new ArticleListView(this);

public class ArticleListView {

    private String source=null;
    private ListView lv;

    public ArticleListView(ListActivity act) {

        // find the list view
        lv = (ListView) act.findViewById(;

        // get the messages
        FeedManager fm = new FeedManager();
        Feed f = fm.getFeed("Some valid feed url");
        List<FeedMessage> messages = f.getMessages();

        // get the adapter for the list
        ArticleDetailAdapter adp = new ArticleDetailAdapter(act,
android.R.layout.simple_list_item_2, messages);



    public void show(){

    public void hide(){

    public void setSource(String source){
        this.source = source;

    public String getSource(){
        return source;



import java.util.List;


import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ArticleDetailAdapter extends ArrayAdapter {

    private LayoutInflater mInflater;
    private List Items;

    public ArticleDetailAdapter(Context context, int textViewResourceId,
List Items) {
        this.Items = Items;
        Log.d("here", "ArticleDetailAdapter");
        mInflater = LayoutInflater.from(context);

    public View getView(int position, View convertView, ViewGroup parent) {

        Log.d("here", "Getview method loading");

        // A ViewHolder keeps references to children views to avoid
unneccessary calls
        // to findViewById() on each row.
        ViewHolder holder;

        // When convertView is not null, we can reuse it directly, there is
no need
        // to reinflate it. We only inflate a new View when the convertView
        // by ListView is null.
        if (convertView == null){
            convertView = mInflater.inflate(R.layout.article_row, null);

            // Creates a ViewHolder and store references to the two children
            // we want to bind data to.
            holder = new ViewHolder();
            holder.titleText = (TextView)
            holder.descriptionText = (TextView)
            //holder.icon = (ImageView)
        } else {
            // Get the ViewHolder back to get fast access to the TextView
            // and the ImageView.
            holder = (ViewHolder) convertView.getTag();

        // Bind the data efficiently with the holder.
        holder.titleText.setText((CharSequence) Items.get(position));
        //holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);

        return convertView;

    static class ViewHolder {
        TextView descriptionText;
        TextView titleText;
        ImageView icon;


3. libjingle ported to java

4. Layout_gravity for a button

5. FYI if you are having trouble in using DOM Parser for parsing general response

6. How to create an HIDDED file in android sdcard?

7. Running Froyo on 2.6.35 kernel