Back to project page RoboBinding-gallery.
The source code is released under:
Apache License
If you think the Android project RoboBinding-gallery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.robobinding.gallery.presentationmodel; /* ww w . j ava2 s. co m*/ import org.robobinding.annotation.ItemPresentationModel; import org.robobinding.annotation.PresentationModel; import org.robobinding.gallery.model.Product; import org.robobinding.gallery.model.typedcursor.GetAllQuery; import org.robobinding.gallery.model.typedcursor.ProductItemPresentationModel; import org.robobinding.itempresentationmodel.TypedCursor; import android.database.sqlite.SQLiteDatabase; /** * @author Cheng Wei * @version $Revision: 1.0 $ * @since 1.0 */ @PresentationModel public class TypedCursorPresentationModel { private final SQLiteDatabase db; private final GetAllQuery<Product> allProductsQuery; private TypedCursor<Product> productCursor; public TypedCursorPresentationModel(SQLiteDatabase db, GetAllQuery<Product> allProductsQuery) { this.db = db; this.allProductsQuery = allProductsQuery; } @ItemPresentationModel(value = ProductItemPresentationModel.class) public TypedCursor<Product> getProducts() { productCursor = allProductsQuery.execute(db); return productCursor; } public void cleanUp() { if (productCursor != null) { productCursor.close(); } } }