Back to project page journal.
The source code is released under:
MIT License
If you think the Android project journal 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 cochrane343.journal.dialogs; //from www.jav a 2 s. c o m import android.content.Context; import android.database.Cursor; import android.support.v4.widget.CursorAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import cochrane343.journal.R; import cochrane343.journal.TranslationHelper; import cochrane343.journal.contentprovider.JournalContract.Category; /** * The {@link CursorAdapter} used to populate the category spinner of the {@link ExpenseDialogFragment}. * * @author cochrane343 * @version 1.0 */ public class CategorySpinnerAdapter extends CursorAdapter { public CategorySpinnerAdapter(final Context context, final Cursor cursor) { super(context, cursor, false); } @Override public View newView(final Context context, final Cursor cursor, final ViewGroup parent) { final LayoutInflater inflater = LayoutInflater.from(context); return inflater.inflate(R.layout.dropdown_item_category, parent, false); } @Override public void bindView(final View view, final Context context, final Cursor cursor) { final int categoryNameIndex = cursor.getColumnIndex(Category._NAME); final String categoryName = cursor.getString(categoryNameIndex); final String translatedCategoryName = TranslationHelper.translate(categoryName, context); final TextView categoryNameTextView = (TextView) view.findViewById(R.id.dropdown_category_name); categoryNameTextView.setText(translatedCategoryName); } }