Back to project page GameTimer.
The source code is released under:
Apache License
If you think the Android project GameTimer 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.solidnw.gametimer.adapter; // w w w .ja v a 2 s. c o m import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.solidnw.gametimer.R; public class GroupAdapter extends ArrayAdapter<String> { private Context mContext; private ArrayList<String> mContent; private int mTheme; public GroupAdapter(Context context, int textViewResourceId, ArrayList<String> objects, int theme) { super(context, textViewResourceId, objects); mContext = context; mContent = objects; mTheme = theme; } public View getCustomView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.spinner_textitem, parent, false); TextView content = (TextView) row.findViewById(R.id.spinneritem_text_content); content.setText(mContent.get(position)); if(mTheme == android.R.style.Theme_Holo) { content.setTextColor(mContext.getResources().getColor(android.R.color.primary_text_dark)); } else if(mTheme == android.R.style.Theme_Holo_Light) { content.setTextColor(mContext.getResources().getColor(android.R.color.primary_text_light)); } return row; } public View getDropDownView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } public View getView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } }