Back to project page sami-android-demo.
The source code is released under:
Apache License
If you think the Android project sami-android-demo 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 io.samsungsami.androidclient; //from w ww . java 2 s . c o m import java.util.ArrayList; import com.samihub.androidclient.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class GenericAdapter extends ArrayAdapter<Item> { private final Context context; private final ArrayList<Item> itemsArrayList; public GenericAdapter(Context context, ArrayList<Item> itemsArrayList) { super(context, R.layout.row, itemsArrayList); this.context = context; this.itemsArrayList = itemsArrayList; } @Override public View getView(int position, View convertView, ViewGroup parent) { // 1. Create inflater LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.row, parent, false); TextView labelView = (TextView) rowView.findViewById(R.id.label); TextView valueView = (TextView) rowView.findViewById(R.id.value); labelView.setText(itemsArrayList.get(position).getItemId()); valueView.setText(itemsArrayList.get(position).getDescription()); return rowView; } }