Created
September 20, 2018 14:07
-
-
Save caneryilmaz/dfe0bef81e8c9f66c9cda5b008de3fa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlockedTypeAdapter extends ArrayAdapter<EngellilikKategorileri> { | |
private List<EngellilikKategorileri> items; | |
public BlockedTypeAdapter(Context context, List<EngellilikKategorileri> objects) { | |
super(context, 0, objects); | |
this.items = objects; | |
} | |
@Override | |
public View getDropDownView(int position, View convertView, ViewGroup parent) { | |
TextView label = (TextView) super.getDropDownView(position, convertView, parent); | |
label.setTextColor(Color.BLACK); | |
label.setText(items.get(position).getTurAdi()); | |
return label; | |
} | |
@Override | |
public int getCount() { | |
return items.size(); | |
} | |
@Override | |
public EngellilikKategorileri getItem(int position) { | |
return items.get(position); | |
} | |
@Override | |
public long getItemId(int position) { | |
return position; | |
} | |
public View getView(int position, View convertView, ViewGroup parent) { | |
View v = convertView; | |
if (v == null) { | |
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
v = inflater.inflate(R.layout.layout_tag_text, null); | |
} | |
EngellilikKategorileri item = items.get(position); | |
if (item != null) { | |
TextView tt = v.findViewById(R.id.text_city_name); | |
tt.setTextSize(15); | |
tt.setText(item.getTurAdi().toString()); | |
} | |
return v; | |
} | |
} | |
//****************//*** | |
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item); | |
spinnerBlockedType.setAdapter(adapter); | |
spinnerBlockedType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |
@Override | |
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |
engellilikBilgi.setKategoriId(list.get(position).getTurId()); | |
} | |
@Override | |
public void onNothingSelected(AdapterView<?> parent) { | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment