title: How to Remove TextView BackGround from listview if value is null?
body: <p>I am making simple offline chat app, till now every thing is working fine but i want to remove the background of textview if value is null. Chat is having simple left right combination.</p>
  
  <p><a href="https://i.stack.imgur.com/2n6jg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2n6jg.png" alt="enter image description here"></a></p>
  
  <pre><code>  protected void showList(){
          try {
              JSONObject jsonObj = new JSONObject(myJSON);
              peoples = jsonObj.getJSONArray(TAG_RESULTS);
  
              for(int i=0;i&lt;peoples.length();i++){
                  JSONObject c = peoples.getJSONObject(i);
                  HashMap&lt;String,String&gt; persons = new HashMap&lt;String,String&gt;();
                  id = c.getString("sender_id");
                  ids = c.getString("rec_id");
                  if(id.equals(session_id)&amp;&amp;ids.equals("admin")) {
                       ss = c.getString("messages");
                      persons.put(TAG_MESSAGE, ss);
                      persons.put("usern", username + ":");
  
                      personList.add(persons);
  
                    }
                      if(id.equals("admin")&amp;&amp;ids.equals(session_id)) {
                      tt = c.getString("messages");
                          persons.put(TAG_ID, tt);
                          persons.put("admin","Admin:");
                          personList.add(persons);
                  }
  
  
  
                  adapter = new SimpleAdapter(
                          Messages.this, personList,
                          R.layout.activity_message,
                          new String[]{"admin",TAG_ID, "usern", TAG_MESSAGE },
                          new int[]{R.id.admin, R.id.id,R.id.name, R.id.messag});
  
                  list.setAdapter(adapter);
  
              }
  
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
      }
  
      public void getData(){
          class GetDataJSON extends AsyncTask&lt;String, Void, String&gt; {
  
              @Override
              protected String doInBackground(String... params) {
  
                  InputStream inputStream = null;
                  String result = null;
                  try {
  
                      String postReceiverUrl = "http://piresearch.in/gpsapp/emp_message.php";
                      //"http://progresscard.progresscard.in/progress_card/messages/get_messages.php";
                      // HttpClient
                      HttpClient httpClient = new DefaultHttpClient();
  
                      // post header
                      HttpPost httpPost = new HttpPost(postReceiverUrl);
  
                      // add your data
                      List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
                      nameValuePairs.add(new BasicNameValuePair("user_id", session_id));
                      httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                      HttpResponse response = httpClient.execute(httpPost);
                      HttpEntity resEntity = response.getEntity();
  
                      inputStream = resEntity.getContent();
                      // json is UTF-8 by default
                      BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
                      StringBuilder sb = new StringBuilder();
  
                      String line = null;
                      while ((line = reader.readLine()) != null)
                      {
                          sb.append(line + "\n");
                      }
                      result = sb.toString();
                  } catch (Exception e) {
                      Log.i("tagconvertstr", "[" + result + "]");
                      System.out.println(e);
                  }
                  finally {
                      try{if(inputStream != null)inputStream.close();}catch(Exception squish){}
                  }
                  return result;
              }
  
              @Override
              protected void onPostExecute(String result){
                  myJSON = result;
                  showList();
              }
          }
          GetDataJSON g = new GetDataJSON();
          g.execute();
      }
  </code></pre>
  
  <p>activity_message.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:padding="10dp"
      android:paddingLeft="10dp"
      android:paddingRight="10dp" &gt;
  
  
  
      &lt;TextView
          android:textSize="20dp"
          android:gravity="start"
          android:textAlignment="textStart"
          android:id="@+id/admin"
          android:text="admin"
          android:textColor="#fff"
          android:layout_gravity="left"
          android:layout_width="wrap_content"
          android:layout_height="30dp"
          android:paddingBottom="2dip"
          android:paddingTop="6dip" /&gt;
  
  
      &lt;TextView
          android:layout_below="@id/admin"
          android:textSize="20dp"
          android:gravity="start"
          android:textAlignment="textStart"
          android:id="@+id/id"
          android:background="@drawable/mystyle"
          android:textColor="#000"
          android:layout_gravity="left"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:paddingBottom="2dip"
          android:paddingTop="6dip" /&gt;
  
  
      &lt;TextView
          android:id="@+id/name"
          android:textSize="20dp"
          android:textColor="#fff"
          android:layout_gravity="right"
          android:layout_width="wrap_content"
          android:layout_height="30dp"
          android:paddingBottom="2dip"
          android:paddingTop="6dip"/&gt;
  
  
  
      &lt;TextView
          android:background="@drawable/mystyle"
          android:layout_below="@id/name"
          android:id="@+id/messag"
          android:textSize="20dp"
          android:textColor="#000"
          android:layout_gravity="right"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:paddingBottom="2dip"
          android:paddingTop="6dip"/&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>activity_list.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/main_background"
      android:orientation="vertical"&gt;
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:textSize="30dp"
          android:text="Your Messages"
          android:textAlignment="center"
          android:background="#dedb36"/&gt;
  
      &lt;ListView
          android:id="@+id/listView"
          android:layout_width="fill_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:background="@null"
          android:divider="@null"
          android:transcriptMode="alwaysScroll"
          android:stackFromBottom="true"/&gt;
      &lt;LinearLayout
  
          android:gravity="bottom"
          android:id="@+id/llMsgCompose"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@color/white"
          android:orientation="horizontal"
          android:weightSum="3"&gt;
  
          &lt;EditText
  
              android:id="@+id/inputMsg"
              android:layout_width="0dp"
              android:layout_height="fill_parent"
              android:layout_weight="2"
              android:background="@color/bg_msg_input"
              android:textColor="@color/text_msg_input"
              android:paddingLeft="6dp"
              android:paddingRight="6dp"/&gt;
  
          &lt;Button
              android:id="@+id/btnSend"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:background="@color/bg_btn_join"
              android:textColor="#fff"
              android:text="Send" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>