Back to project page android-facade-example.
The source code is released under:
MIT License
If you think the Android project android-facade-example 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.ruenzuo.weatherapp.adapters; /*from www.j a v a2s .c o m*/ import android.app.Activity; 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.ruenzuo.weatherapp.R; import com.ruenzuo.weatherapp.models.City; /** * Created by ruenzuo on 08/05/14. */ public class CitiesAdapter extends ArrayAdapter<City> { private int resourceId; public CitiesAdapter(Context context, int resource) { super(context, resource); resourceId = resource; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater(); convertView = inflater.inflate(resourceId, null); } City country = getItem(position); TextView txtViewCityName = (TextView) convertView.findViewById(R.id.txtViewCityName); txtViewCityName.setText(country.getName()); return convertView; } }