Back to project page groceryviewer.
The source code is released under:
GNU General Public License
If you think the Android project groceryviewer 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 com.github.knrajago.groceryviewer.listadapters; //www .ja va2 s .co m import com.github.knrajago.groceryviewer.R; import android.content.Context; import android.database.Cursor; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.TextView; import static com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.APPLICATION_TAG; import static com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.ITEM_COL; public class GroceryListAdapter extends CursorAdapter { LayoutInflater mLayoutInflater = null; public GroceryListAdapter(Context pContext, Cursor c, boolean autoRequery) { super(pContext, c, autoRequery); mLayoutInflater = LayoutInflater.from(pContext); } public GroceryListAdapter(Context pContext, Cursor c, int flags) { super(pContext, c, flags); } @Override public void bindView(View pView, Context pContext, Cursor pCursor) { updateView(pView, pCursor); } @Override public View newView(Context pContext, Cursor pCursor, ViewGroup pParent) { String methodName = "newView"; Log.i(APPLICATION_TAG, methodName + " entering"); View view = mLayoutInflater.inflate(R.layout.grocery_item_view, pParent, false); updateView(view, pCursor); Log.i(APPLICATION_TAG, methodName + " exiting"); return view; } private void updateView(View pView, Cursor pCursor) { String methodName = "updateView"; Log.i(APPLICATION_TAG, methodName + " entering"); TextView txtView = (TextView) pView.findViewById(R.id.grocery_itm_txt); txtView.setText(pCursor.getString(pCursor.getColumnIndex(ITEM_COL))); Log.i(APPLICATION_TAG, methodName + " entering"); } }