I'm trying to make an app to take a photo, display it in imageview, and extract the colors with the Palette library. All this I've done.
What I need is to display the result (Population) as a percentage of the total, not the number of pixels. Could someone help?
Thank you very much in advance.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if( convertView == null ) {
holder = new ViewHolder();
convertView = LayoutInflater.from( getContext() ).inflate( R.layout.color_item, parent, false );
holder.view = (TextView) convertView.findViewById( R.id.view );
convertView.setTag( holder );
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.view.setBackgroundColor(getItem(position).getRgb());
holder.view.setTextColor(getItem(position).getBodyTextColor());
holder.view.setText("Population: " + getItem(position).getPopulation());
return convertView;
}