recycle basically means..free/clearing all the data associated with corresponding resource.
In Android we can find recycle for Bitmap and TypedArray.
If you check both source files then you can find a boolean variable "mRecycled" which is "false"(default value). It is assigned to "true" when recycle is called.
So, Now if you check that method(recycle method in both the classes) then you we can observe that they are clearing all the values.
For reference here are the methods.
Bitmap.java:
public void recycle() {
if (!mRecycled && mNativePtr != 0) {
if (nativeRecycle(mNativePtr)) {
// return value indicates whether native pixel object was actually recycled.
// false indicates that it is still in use at the native level and these
// objects should not be collected now. They will be collected later when the
// Bitmap itself is collected.
mBuffer = null;
mNinePatchChunk = null;
}
mRecycled = true;
}
}
TypedArray.java
public void recycle() {
if (mRecycled) {
throw new RuntimeException(toString() + " recycled twice!");
}
mRecycled = true;
// These may have been set by the client.
mXml = null;
mTheme = null;
mAssets = null;
mResources.mTypedArrayPool.release(this);
}
this line
mResources.mTypedArrayPool.release(this);
will release the typedArray from the SunchronisedPool whose default value is 5.
So you shouldn't use same typedArray again as it gets cleared.
once "mRecycled" of TypedArray is true then while getting its properties it will throw RuntimeException saying "Cannot make calls to a recycled instance!".
simliar behaviour incase of Bitmap as well.
Hope it helps.