Back to project page Android_OSM_offlinemap.
The source code is released under:
GNU General Public License
If you think the Android project Android_OSM_offlinemap 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.vellut.offlinemap; /* w w w . j a v a 2 s. c o m*/ import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; public class ColorPickerAdapter extends ArrayAdapter<Integer> { private int resourceId; private Context context; public ColorPickerAdapter(Context context, int resource, Integer[] objects) { super(context, resource, objects); this.context = context; this.resourceId = resource; } public ColorPickerAdapter(Context context, int resource, List<Integer> objects) { super(context, resource, objects); this.context = context; this.resourceId = resource; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } @Override public View getView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } private View getCustomView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(resourceId, parent, false); } convertView.setBackgroundColor(getItem(position)); return convertView; } }