title: ListView with custom adapter not getting updated
body: <p>I want to update the list view whenever any item is updated or deleted.I have tried many options,but none of them is working.This is the code of the list view:</p>
  
  <pre><code>public class HelloBubblesActivity extends Activity {
      private com.warting.bubbles.DiscussArrayAdapter adapter;
      private ListView lv;
      private LoremIpsum ipsum;
      private EditText editText1;
      private static Random random;
      Runnable m_handlerTask;
      TextView tv ;
      LinearLayout ll;
      Handler m_handler;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_discuss);
  
          lv = (ListView) findViewById(R.id.listView1);
  
          adapter = new DiscussArrayAdapter(getApplicationContext(), R.layout.listitem_discuss);
  
          lv.setAdapter(adapter);
  
          ll = (LinearLayout)findViewById(R.id.wrapper);
          m_handler = new Handler();
          addItems();
          ReduceTimeIteration();
  
      }
  
       public void ReduceTimeIteration()
       {
              adapter.clear();
              ((BaseAdapter) lv.getAdapter()).notifyDataSetChanged();
              adapter.notifyDataSetChanged();
              adapter.notifyDataSetInvalidated();
              lv.invalidate();
              lv.requestLayout();
              Log.d("Adapter: ", "Adapter is changed");
       }
      private String addItems() {
          String a = "Hello bubbles";
          adapter.add(new OneComment(true,a));
          return a;
      }
  }
  </code></pre>
  
  <p>This is the code of the custom adapter:</p>
  
  <pre><code>public class DiscussArrayAdapter extends ArrayAdapter&lt;OneComment&gt; {
  
      private TextView countryName;
      private List&lt;OneComment&gt; countries = new ArrayList&lt;OneComment&gt;();
      private LinearLayout wrapper;
      static View row ;
  
      @Override
      public void add(OneComment object) {
          countries.add(object);
          super.add(object);
      }
  
      public DiscussArrayAdapter(Context context, int textViewResourceId) {
          super(context, textViewResourceId);
      }
  
      public int getCount() {
          return this.countries.size();
      }
  
      public OneComment getItem(int index) {
          return this.countries.get(index);
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          row = convertView;
          if (row == null) {
              LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row = inflater.inflate(R.layout.listitem_discuss, parent, false);
          }
  
          wrapper = (LinearLayout) row.findViewById(R.id.wrapper);
  
          OneComment coment = getItem(position);
  
          countryName = (TextView) row.findViewById(R.id.comment);
  
          countryName.setText(coment.comment);
  
          countryName.setBackgroundResource(coment.left ? R.drawable.bubble_yellow : R.drawable.bubble_green);
          wrapper.setGravity(coment.left ? Gravity.LEFT : Gravity.RIGHT);
  
          return row;
      }
  
      public Bitmap decodeToBitmap(byte[] decodedByte) {
          return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
      }
  
  }
  </code></pre>
  
  <p>In the list view, i want to remove all the views using <code>adapter.clear()</code> and then want to update the list view.But even after calling adapter.clear() , the list view remains the same.Please help me. Thanks in advance.</p>