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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:43:49+00:00 2026-05-29T09:43:49+00:00

Okay,I’ve been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/ Basically it gives me exactly what i need

  • 0

Okay,I’ve been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/
Basically it gives me exactly what i need for my app

ONLY , I need the search button (or query) to be autoclicked…

I want the user to open the app and see the list already queried

also I have integrated this tutorial into a Tab application, so keep that in mind…

Please any help would be amazing!!! thank you a lot for taking time out of your lives to help me with this stupid thing

I’m a complete noob , I’m learning as I go

Thanka a lot again!

Fadi

  • 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-29T09:43:50+00:00Added an answer on May 29, 2026 at 9:43 am

    I think the best way to achieve ‘autoclicking’ would be through the textwatcher-interface:

    http://developer.android.com/reference/android/text/TextWatcher.html

    Like this:

    EditText.addTextChangedListener(...)
    
    afterTextChanged(Editable s)
    {
    //Make your query here using s.getText().toString
    //as your WHERE-Clause
    }
    

    I would advise you, to debug while using the TextWatcher just to understand how it works 😉
    You should also consider that this method could use up a lot of memory, since you query your database with every letter that is typed. You could count the letters typed though, in

    onTextChanged(CharSequence s, int start, int before, int count)
    

    and setting a boolean value to true, when the user has typed more then 2 letters and start querying your DB then to avoid too much memory usage.

    Edit:

    This is the original search-Method:

    public void search(View view) {
            // || is the concatenation operation in SQLite
                    cursor = db.rawQuery("SELECT _id, firstName, lastName, title FROM employee WHERE firstName || ' ' || lastName LIKE ?", 
                                                    new String[]{"%" + searchText.getText().toString() + "%"});
                    adapter = new SimpleCursorAdapter(
                                    this, 
                                    R.layout.employee_list_item, 
                                    cursor, 
                                    new String[] {"firstName", "lastName", "title"}, 
                                    new int[] {R.id.firstName, R.id.lastName, R.id.title});
                    employeeList.setAdapter(adapter);
        }
    

    Now try it like this:

    searchText.addTextChangedListener(new TextWatcher() {
    
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    } 
    @Override
    afterTextChanged(Editable s){
                // || is the concatenation operation in SQLite
                        cursor = db.rawQuery("SELECT _id, firstName, lastName, title FROM employee WHERE firstName || ' ' || lastName LIKE ?", 
                                                        new String[]{"%" + s.getText().toString() + "%"});
                        adapter = new SimpleCursorAdapter(
                                        this, 
                                        R.layout.employee_list_item, 
                                        cursor, 
                                        new String[] {"firstName", "lastName", "title"}, 
                                        new int[] {R.id.firstName, R.id.lastName, R.id.title});
                        employeeList.setAdapter(adapter);
          }
    });
    

    There are some blanks in the code which you have to fill in by yourself. But that’s the basic idea behind my first post.

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

Sidebar

Related Questions

Okay, so I'm trying to make a game that uses this algorithm: http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection But
Okay, so this seems simple, but I can't think of a straightforward solution; Basically
Okay so im working on this php image upload system but for some reason
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my
Okay. I know this looks like the typical Why didn't he just Google it
Okay, we know that the following two lines are equivalent - (0 == i)
Okay, I have the following PHP code to extract an email address of the
Okay, here's my current code for an array. $sites[0]['url'] = http://example0.com; $sites[1]['url'] = http://example1.com;
Okay so I haven't been able to find a question with an answer yet,
Okay I do not even know where to begin when it comes to this

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.