Back to project page Freebloks-Android.
The source code is released under:
GNU General Public License
If you think the Android project Freebloks-Android 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 de.saschahlusiak.freebloks.stats; // w w w .j a v a2 s . com import de.saschahlusiak.freebloks.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class StatisticsAdapter extends BaseAdapter { String labels[]; String values1[]; Context context; StatisticsAdapter(Context context, String[] labels, String[] values1) { this.context = context; this.labels = labels; this.values1 = values1; } @Override public int getCount() { return labels.length; } @Override public Object getItem(int position) { return null; } @Override public boolean isEnabled(int position) { if (values1[position] == null) return false; return true; } @Override public boolean areAllItemsEnabled() { return true; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = LayoutInflater.from(context).inflate(R.layout.statistics_item, parent, false); v.findViewById(android.R.id.text1).setEnabled(isEnabled(position)); v.findViewById(R.id.text2).setEnabled(isEnabled(position)); ((TextView)v.findViewById(android.R.id.text1)).setText(labels[position]); ((TextView)v.findViewById(R.id.text2)).setText(values1[position] == null ? "--" : values1[position]); return v; } }