title: How to use Content Provider and Content Observer in API Level 8?
body: <p>I want to use <code>Content Provider</code> and <code>Content Observer</code> from the Api level-8. I am able to create this in Api-15 (ICS). but i have to support my app from Api-8. </p>
  
  <p>If i mention android:minSdkVersion="8" like this i am getting this errors
  <code>Class requires API level 11 (current min is 8): android.content.Loader</code>. </p>
  
  <pre><code>import android.app.ListActivity;
  import android.content.ContentValues;
  import android.support.v4.app.LoaderManager;
  import android.support.v4.content.CursorLoader;
  import android.support.v4.content.Loader;
  import android.content.Intent;
  import android.database.Cursor;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.ContextMenu;
  import android.view.ContextMenu.ContextMenuInfo;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.AdapterView.AdapterContextMenuInfo;
  import android.widget.EditText;
  
  public class TodosOverviewActivity extends ListActivity implements     LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
  
  private static final int DELETE_ID = Menu.FIRST + 1;     
  private ConverstationsAdapter adapter;
  private EditText Enter_Text; 
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.todo_list);
      this.getListView().setDividerHeight(2);
      fillData();
      registerForContextMenu(getListView());
      Enter_Text = (EditText) findViewById(R.id.msg);
  
      findViewById(R.id.send_button).setOnClickListener(new OnClickListener() {           
          @Override
          public void onClick(View v) {   
              SendInfo();
          }
      });
  }
  
  private void SendInfo() {
  
      String msg = Enter_Text.getText().toString().trim();
      ContentValues values = new ContentValues();
      values.put(TodoTable.COLUMN_RECEIVER, "Reddy");
      values.put(TodoTable.COLUMN_SENDER, "RA");
      values.put(TodoTable.COLUMN_MSG, msg);
  
      getContentResolver().insert(MyTodoContentProvider.CONTENT_URI, values);
  }
  
  @Override
  public boolean onContextItemSelected(MenuItem item) {
      switch (item.getItemId()) {
      case DELETE_ID:
          AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
          Uri uri = Uri.parse(MyTodoContentProvider.CONTENT_URI + "/" + info.id);
          getContentResolver().delete(uri, null, null);
          fillData();
          return true;
      }
      return super.onContextItemSelected(item);
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
      super.onActivityResult(requestCode, resultCode, intent);
  }
  
  private void fillData() {  
      getLoaderManager().initLoader(0, null, this);   // error here   
      adapter = new ConverstationsAdapter(TodosOverviewActivity.this, null );
      setListAdapter(adapter);
  }
  
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
      super.onCreateContextMenu(menu, v, menuInfo);
      menu.add(0, DELETE_ID, 0, R.string.menu_delete);
  }
  
  // Creates a new loader after the initLoader () call
  @Override
  public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) {
      String[] projection = { TodoTable.COLUMN_ID, TodoTable.COLUMN_MSG };
      CursorLoader cursorLoader = new CursorLoader(this,
              MyTodoContentProvider.CONTENT_URI, projection, null, null, null);
      return cursorLoader;
  }
  
  @Override
  public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {
      adapter.swapCursor(data);
  }
  
  @Override
  public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
      // data is not available anymore, delete reference
      adapter.swapCursor(null);
  }
  }
  </code></pre>