title: Android getLoaderManager().initLoader saying that I can't use this
body: <p>while I was developing an app for Android I encountered a problem with the LoaderManager. Whenever I try to use the following code: </p>
  
  <p><code>getLoaderManager().initLoader(0, null, this);</code> </p>
  
  <p>It tells me that I can't use this. here is a part of my code:</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
  
      private CursorAdapter cursorAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          insertNote("New Note");
  
          String[] from = {DBComHelper.NOTE_TEXT};
          int[] to = {android.R.id.text1};
  
          cursorAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, from, to, 0);
  
          ListView list = (ListView) findViewById(android.R.id.list);
          list.setAdapter(cursorAdapter);
  
          getLoaderManager().initLoader(0, null, this);
      }
  </code></pre>
  
  <p>Here is the activity code:</p>
  
  <pre><code>package com.berendhulshof.privatenotes;
  
  import android.content.ContentValues;
  import android.database.Cursor;
  import android.net.Uri;
  import android.support.v4.app.LoaderManager;
  import android.support.v4.content.CursorLoader;
  import android.support.v4.content.Loader;
  import android.support.v4.widget.CursorAdapter;
  import android.support.v4.widget.SimpleCursorAdapter;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v4.app.FragmentActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.ListView;
  
  public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
  
      private CursorAdapter cursorAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          insertNote("New Note");
  
          String[] from = {DBComHelper.NOTE_TEXT};
          int[] to = {android.R.id.text1};
  
          cursorAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, from, to, 0);
  
          ListView list = (ListView) findViewById(android.R.id.list);
          list.setAdapter(cursorAdapter);
  
          getLoaderManager().initLoader(0, null, this);
      }
  
      private void insertNote(String noteText) {
          ContentValues values = new ContentValues();
          values.put(DBComHelper.NOTE_TEXT, noteText);
          Uri noteUri = 
          getContentResolver().insert(NotesProvider.CONTENT_URI, values);
          Log.d("MainActivity", "Inserted note "  + noteUri.getLastPathSegment());
      }
  
      @Override
      public Loader onCreateLoader(int id, Bundle args) {
          return new CursorLoader(this, NotesProvider.CONTENT_URI, null, null, null, null);
      }
  
      @Override
      public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {
          cursorAdapter.swapCursor(data);
      }
  
      @Override
      public void onLoaderReset(Loader loader) {
          cursorAdapter.swapCursor(null);
      }
  }
  </code></pre>
  
  <p>Can somebody please explain me what I'm doing wrong here?</p>