title: Refreshing List view in Listfragment after DB update
body: <p>I use the same activity for save and edit purpose. I have a list view. </p>
  
  <p>In List fragment I have </p>
  
  <pre><code>@Override
      public void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
          if(dbHelper != null){
              Item item = (Item) this.getListAdapter().getItem(position);
              Intent intent = new Intent(getActivity(), SaveEditActivity.class);
              intent.putExtra("Update_Item", item);
              startActivity(intent);
          }
      }
  </code></pre>
  
  <p>Now in SaveEditActivity I have</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(....);
          Intent intent = getIntent();
          if(intent.hasExtra("Update_Item")){
              Item item = (Item) intent.getSerializableExtra("Update_Item");
              if(item != null){
                  this.isEdit = true;
                  this.editedItem = item;
                  setItemData(item); // set the data in activity
              }
          }
  }
  </code></pre>
  
  <p>Now when user clicks on save button I check for isEdit flag</p>
  
  <pre><code> if(isEdit == true){
          updateItem();//update
       }else{
        saveItem(); // add
       }
   }
  </code></pre>
  
  <p>In Update method I update the item in database using <code>editedItem</code> Object</p>
  
  <pre><code>private void updateItem(){
        if(this.editedItem != null){
            dbHelper.updateItem(editedItem);
        }
      }
  </code></pre>
  
  <p>But my list view is not refreshed with new data. </p>
  
  <p>I am using <code>customAdapter</code> which extends <code>BaseAdapter</code>.</p>
  
  <p>In ListFragmet I load the data into adapter in onResume() method</p>
  
  <pre><code>@Override
      public void onResume() {
          super.onResume();
          dbHelper = new DatabaseHandler(getActivity());
          List&lt;Item&gt; existingItems = dbHelper.getItemData();
          adapter = new CustomAdapter(getActivity().getApplicationContext(), existingItems);
          if(adapter != null){
             this.setListAdapter(adapter);
             adapter.notifyDataSetChanged();
          }
      }
  </code></pre>
  
  <p>Now when returning from activity this method should be called and adapter should be notified of the change? Isnt that right?</p>
  
  <p>Can anyone help please?</p>