I have this function in the bottom, In this function I fill the listview in the MainActivity, I can fill with any text I want, but I do not know how to hide, I tried the thing in the comment part to hide it, but did not work.
I need to check a certain condition and if true hide R.id.dire_win, if false hide R.id.radiant_win
Also I need to fill R.id.team01_pic in each row of the list view with an .png/.jpg url.
Thanks for your help in advance.
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
SingleContactActivity.this, matchList,
R.layout.list_match, new String[] { TAG_team01_name, TAG_team02_name , TAG_RESULT }, new int[] {
R.id.team01_name, R.id.team02_name , R.id.result});
//ImageView imgView = (ImageView) findViewById(R.id.radiant_win);
//imgView.setVisibility(View.INVISIBLE);
//TextView textview =(TextView )findViewById(R.id.text);
setListAdapter(adapter);
}
Update: I tried to create this function as one of the answers said, but did not work .
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View rowView = inflater.inflate(R.layout.list_match, parent, false);
//TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.radiant_win);
//textView.setText(values[position]);
// change the icon for Windows and iPhone
//String s = values[position];
imageView.setImageResource(R.drawable.team_navi);
//imageView.setVisibility(View.INVISIBLE);
return rowView;
}