@Override public View getView(int position, View convertView, ViewGroup parent) { View row = null; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.subscription_package_row, parent, false); } else { row = convertView; } String list_items = li.get(position); sa.us_li = li; String[] list_item = list_items.split("/"); TextView du, dwn, pimg, prc, state, disc; du = (TextView) row.findViewById(R.id.du); du.setText(list_item[1] + " Month"); dwn = (TextView) row.findViewById(R.id.dwn); dwn.setText(list_item[2] + " a day"); pimg = (TextView) row.findViewById(R.id.pimg); pimg.setText("$ " + list_item[3]); prc = (TextView) row.findViewById(R.id.prc); prc.setText("$ " + list_item[4]); disc = (TextView) row.findViewById(R.id.disc); Log.d("Disco", list_item[5]); if (Double.parseDouble(list_item[5]) == 0.0) { disc.setVisibility(View.GONE); } else { disc.setVisibility(View.VISIBLE); disc.setText("SAVE " + Double.parseDouble(list_item[5]) + "%"); } state = (TextView) row.findViewById(R.id.state); state.setVisibility(View.GONE); if (Integer.parseInt((list_item[6])) == 2) { state.setVisibility(View.VISIBLE); state.setText("New Package"); state.setBackgroundColor(sa.getResources().getColor(R.color.md_green_600)); state.setTextColor(sa.getResources().getColor(R.color.md_text_white)); } else { state.setVisibility(View.VISIBLE); state.setText(list_item[2] + " a day"); state.setBackgroundColor(sa.getResources().getColor(R.color.md_blue_700)); state.setTextColor(sa.getResources().getColor(R.color.md_text_white)); } return row; }
public void stringResponse(String s) { sa.stringResponse(s); }
public void stringErrorMsg(String s) { sa.stringErrorMsg(s); }