title: android: How to change ListViewItem Background on runtime? (Not for selection)
body: <p>In my android app, I need to change the Background color of each Item of my ListView   seperately.<br>
  I found no examples or helpful documentation. The background should change if the value of a double is 0. I set the ListView Property:  <code>android:drawSelectorOnTop="true"</code>  and used following code:<br>
  (All of it functions, only the background doesn't change!)  How can I solve this problem?</p>
  
  <pre><code>public void onClickButtonOKStand (View view) {
          EditAusgabe = (EditText) findViewById(R.id.EditText01);
          if (EditAusgabe.getText().toString().length() &lt;= 0) {
              Toast T = Toast.makeText(getApplicationContext(), "Eingabe ungültig! Geben Sie einen Betrag ein", Toast.LENGTH_LONG);
              T.show();
              return;
          }
          if (EditAusgabe.getText().toString() == ".") {
              Toast T = Toast.makeText(getApplicationContext(), "Eingabe ungültig! Geben Sie einen Betrag ein", Toast.LENGTH_LONG);
              T.show();
              return;         
          }
  
          Z = Double.parseDouble(EditAusgabe.getText().toString());
  
          if (VArt == "Down") {
              if (VStand &gt;= Z) {
                  VStand = VStand - Z;
                  if (VStand &lt;= 0.39) {
                      Toast T = Toast.makeText(getApplicationContext(), "Ihr Guthaben ist aufgebraucht!", Toast.LENGTH_strong textLONG);
                      T.show();
                      VStand = 0.00;
  
  ****************** The next line is my problem: ******************************
  
  StartListe.getChildAt(Position).setBackgroundColor(color.holo_red_light);
                  }
              }
              else if (VStand &lt; Z) {
                  Toast T = Toast.makeText(getApplicationContext(), "Vorgang nicht möglich! Ihr Konto liegt bei " + FORMAT.format(VStand) + " €.", Toast.LENGTH_LONG);
                  T.show();
                  EditAusgabe.setText("");
                  return;
              } 
          }
  
          if (VArt == "Up") {
              VStand = VStand + Z;
          }
  
          Stand.set(Position, FORMAT.format(VStand));
          Liste.set(Position, (VName + "               " + FORMAT.format(VStand) + " € / " + FORMAT.format(VWert) + " €"));
          ListeAktualisieren();
      }
  
      public void ListeAktualisieren () {
          setContentView(R.layout.activity_ausgabenkontrolle);
          ArrayAdapter&lt;String&gt; ListenAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, Liste);
          StartListe = (ListView) findViewById(R.id.listView1);
          StartListe.setAdapter(ListenAdapter);
          StartListe.setOnItemClickListener(new OnItemClickListener() {
  
              public void onItemClick(AdapterView&lt;?&gt; ListenAdapter, View view, int i, long ID) {
                  // TODO Auto-generated method stub
                  Item = view;
                  Position = ListenAdapter.getPositionForView(view);
                  VName = Namen.get(Position);
                  VArt = Arten.get(Position);
                  VWert = Double.parseDouble(Werte.get(Position).toString());
                  VStand = Double.parseDouble(Stand.get(Position).toString());
                  setContentView(R.layout.activity_stand);
                  if (VArt == "Down") {
                      if (VStand == 0) {
                      Toast T = Toast.makeText(getApplicationContext(), "Ihr Guthaben ist aufgebraucht!", Toast.LENGTH_LONG);
                      T.show();
                      }
                  }
              }
          });
          registerForContextMenu(StartListe);
      }
  </code></pre>