Created
April 2, 2013 13:39
-
-
Save cyrilmottier/5292270 to your computer and use it in GitHub Desktop.
Passing additional information into a Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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