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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:03:20+00:00 2026-06-16T17:03:20+00:00

Instead of using some of the deprecated SimpleCursorAdapter constructors, many people have suggested to

  • 0

Instead of using some of the deprecated SimpleCursorAdapter constructors, many people have suggested to use LoaderManager and CursorLoader. So when calling getLoaderManager().initLoader() it gives me this error:

The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks) in the type LoaderManager is not applicable for the arguments (int, null, SearchResultsActivity)

I have tried importing the v4 version of the loadermanager and cursorloader, but that has not seem to work. I have also tried the getSupportLoaderManager(), which doesn’t work as well. I noticed that some people are getting this error and have looked through the conversation to try and find solutions, but the ones I have found don’t work. I am calling the LoaderManager within the showResults() method btw

Code for searchable activity:

import android.os.Bundle;
import android.app.LoaderManager;
import android.app.LoaderManager.LoaderCallbacks;
import android.app.SearchManager;
import android.app.ListActivity;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.SimpleCursorAdapter;
import android.content.Context;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
public class SearchResultsActivity extends FragmentActivity {

private ListView list;
DatabaseTable db;
LoaderManager lm;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_results);
    db = new DatabaseTable(this);
    handleIntent(getIntent());
}

public void onNewIntent(Intent intent) {
    setIntent(intent);
    handleIntent(intent);
}

private void handleIntent(Intent intent) {
     if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        showResults(query);
    }

}

private void showResults(String query) {
    db = new DatabaseTable(this);
    Cursor cursor = db.getContactMatches(query, null);
    list = (ListView)findViewById(android.R.id.list);
    getSupportLoaderManager().initLoader(0, null, this);
    SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, 
            null, new String[] {DatabaseTable.COL_NAME}, new int[] {android.R.id.text1}, 0);
    list.setAdapter(mAdapter);
    list.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent contactIntent = new Intent(getApplicationContext(), ContactActivity.class);
            contactIntent.setData(getIntent().getData());
            startActivity(contactIntent);
        }
    });
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

 // Associate searchable configuration with the SearchView
    SearchManager searchManager =
           (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView =
            (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(
            searchManager.getSearchableInfo(getComponentName()));
    return true;

}

 @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.search:
                onSearchRequested();
                return true;
            default:
                return false;
        }
    }

}

  • 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-06-16T17:03:21+00:00Added an answer on June 16, 2026 at 5:03 pm

    The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks) in the type LoaderManager is not applicable for the arguments (int, null, SearchResultsActivity)

    Simply put: SearchResultsActivity must implement LoaderManager.LoaderCallbacks. Otherwise this doesn’t refer to an instance of LoaderManager.LoaderCallbacks…

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

Sidebar

Related Questions

What would be some advantages of using etags/stale?/fresh_when? instead of page caching (on a
some (most) of opencv errors are discovered in run time - using CV_64 instead
i've didn't found some examples to create NSPopover dynamically instead using the Interface Builder.
Hmm. Instead of defanging input or using some kind of regex to remove tags,
I've been using the old v3.0 C# SDK for some time and Facebook have
Well...I feel absolutely stupid. Here's why: I have been using some library functions I
Instead using the google search appliance crawler for index content, im using a query
Instead using of: if ( ! $('#XX').is(':visible) ) Is there a value called invisible
Instead of using an interface like this: public interface IStartable { void Start(); void
Instead of using an external web-based Mercurial host, I want to set one up

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.