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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:53:21+00:00 2026-05-16T14:53:21+00:00

I’m still trying to implement a search function into my Android app. So far

  • 0

I’m still trying to implement a search function into my Android app. So far it’s going ok, although currently the search can only query one table and display the results for this table (its a ListView using SimpleCursorAdapter).

What I want is to be able to search multiple tables, but I’m not sure how to get this all into one cursor or extend the SimpleCursorAdapter to implement multiple cursors. I see there is a class called CursorJoiner, but I’m not sure what I need to do with it.

Thanks!

I have tried to make a custom cursor[] adapter, but this doesn’t return anything and my search results are blank- can anyone help?

public class SearchCursorAdapter extends SimpleCursorAdapter {

private int currentCursor;
private int curPosition = 0;
private int total = 0;
private Cursor[] curs = null;
private Context cont;

public SearchCursorAdapter(Context context, int layout, Cursor c,
        String[] from, int[] to) {

    super(context, layout, c, from, to);
    total = c.getCount();

}

public SearchCursorAdapter(Context context, int layout, Cursor[] c,
        String[] from, int[] to) {

    super(context, layout, null, from, to);
    int l = c.length;
    for (int i = 0; i < l; i++) {

        total += c[i].getCount();

    }
    curs = c;
    currentCursor = 0;
    cont = context;
}

@Override
public View getView(int position, View view, ViewGroup parent) {

    if (currentCursor == curs.length)
        return null;

    if (curs == null) {

        //normal shiz

    }
    else {

        Cursor c = curs[currentCursor];
        c.moveToPosition(curPosition);

        if (c.isAfterLast()) {

            currentCursor++;
            c = curs[currentCursor];
            curPosition = 0;
            c.moveToPosition(curPosition);

        }

        if (view == null) {
            LayoutInflater vi = (LayoutInflater)parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = vi.inflate(R.layout.search_row, null);
        }

        TextView t1 = (TextView)view.findViewById(R.id.rowitem_text1);
        TextView t2 = (TextView)view.findViewById(R.id.rowitem_text2);

        t1.setText(c.getString(1));
        t2.setText("Testing");

        curPosition++;

    }

    return view;

just noticed that it’s not actually the adapter returning nothing, there’s something wrong with my searchactivity…

  • 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-05-16T14:53:22+00:00Added an answer on May 16, 2026 at 2:53 pm

    What I want is to be able to search
    multiple tables, but I’m not sure how
    to get this all into one cursor or
    extend the SimpleCursorAdapter to
    implement multiple cursors

    If you are using SQLite, implement a JOIN in your SELECT statement. If you have wrapped SQLite in a content provider for some reason, expose another content Uri and support for your multi-table search.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

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.