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; //ww w .ja v a 2 s . 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 java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by ruenzuo on 10/05/14. */ public class StationDataAdapter extends ArrayAdapter<String> { private int resourceId; private ArrayList<String> titles; public StationDataAdapter(Context context, int resource) { super(context, resource); resourceId = resource; titles = new ArrayList<String>(Arrays.asList(context.getResources().getStringArray(R.array.titles))); } @Override public boolean isEnabled(int position) { return false; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater(); convertView = inflater.inflate(resourceId, null); } String value = getItem(position); TextView txtViewValueTitle = (TextView) convertView.findViewById(R.id.txtViewValueTitle); txtViewValueTitle.setText(titles.get(position)); TextView txtViewValue = (TextView) convertView.findViewById(R.id.txtViewValue); txtViewValue.setText(value); return convertView; } }