Skip to content

Instantly share code, notes, and snippets.

@antslava
Forked from cyrilmottier/gist:5292270
Created April 2, 2013 13:55
Show Gist options
  • Save antslava/5292375 to your computer and use it in GitHub Desktop.
Save antslava/5292375 to your computer and use it in GitHub Desktop.
package com.cyrilmottier.android.avelov.database;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.os.Bundle;
/**
* A Cursor that completely re-writes the actual Cursor capabilities related to extras. It allows clients to use the setExtras(Bundle) (this
* method is actually hidden in the Android framework).
*
* @author Cyril Mottier
*/
public class MetaCursor extends CursorWrapper {
private Bundle mExtras = Bundle.EMPTY;
public MetaCursor(Cursor cursor) {
super(cursor);
}
/**
* Sets a {@link android.os.Bundle} that will be returned by {@link #getExtras()}. <code>null</code> will be converted into {@link
* android.os.Bundle#EMPTY}.
*
* @param extras {@link android.os.Bundle} to set.
*/
public void setExtras(Bundle extras) {
mExtras = extras == null ? Bundle.EMPTY : extras;
}
@Override
public Bundle getExtras() {
return mExtras;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment