I am trying to update listView from another fragment class after i delete an item from listView from current class. For example, i delete a consumer that has an expense, then the expense of that consumer will also be deleted. But consumer and expense is different page that using tab control, which is fragment, when i delete consumer, the expense list is not updated, until i go to previous page, then enter the page again. What can i do to update the expense list when consumer from consumer list is deleted? i heard of using broadcast receiver is able to do that, but how can i implement it in my code? I am new in android, please guide me.Thanks

Here is the code for consumer/participant list : 

```
public class Participant extends ListFragment implements OnClickListener{

Intent intent;
TextView friendId;
Button addparticipant;
String eventId;
ListView lv;

public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    EventController controller = new EventController(getActivity());

    HashMap<String, String> queryValues = new HashMap<String, String>();
    Intent objIntent = getActivity().getIntent();
    eventId = objIntent.getStringExtra("eventId");
    queryValues.put("eventId", eventId);
    ArrayList<HashMap<String, String>> friendList = controller
            .getAllFriends(queryValues);
    if (friendList.size() != 0) {
        lv = getListView();
        lv.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                friendId = (TextView) view.findViewById(R.id.friendId);
                String valFriendId = friendId.getText().toString();
                Intent objIndent = new Intent(getActivity(),
                        EventPage.class);
                objIndent.putExtra("friendId", valFriendId);
                startActivity(objIndent);
            }
        });
        lv.setOnItemLongClickListener(new OnItemLongClickListener(){

            @Override
            public boolean onItemLongClick(AdapterView<?> arg0,
                    View arg1, int arg2, long arg3) {
                // TODO Auto-generated method stub
                friendId = (TextView) arg1.findViewById(R.id.friendId);
                registerForContextMenu(getListView());
                return false;
            }

        });
        SimpleAdapter adapter = new SimpleAdapter(getActivity(),
                friendList, R.layout.view_friend_entry, new String[] {
                        "friendId", "friendName", "friendSpending" },
                new int[] { R.id.friendId, R.id.friendName,
                        R.id.friendSpending });
        adapter.notifyDataSetChanged();
        setListAdapter(adapter);
    }
}

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.participant, container, false);
    addparticipant = (Button) rootView.findViewById(R.id.addpart);
    addparticipant.setOnClickListener(this);
    return rootView;

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent objIntent = new Intent(getActivity(),
            AddParticipant.class);
    objIntent.putExtra("eventId", eventId);
    startActivity(objIntent);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
        ContextMenuInfo menuInfo) {
    String[] menuItems = getResources().getStringArray(R.array.menu);
    for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
    }
}

@Override
public boolean onContextItemSelected(MenuItem item) {
    int menuItemIndex = item.getItemId();
    EventController controller = new EventController(getActivity());
    switch (menuItemIndex) {
    case 0:
        String valFriendId = friendId.getText().toString();
        Intent objIndent = new Intent(getActivity(),
                EditParticipant.class);
        objIndent.putExtra("friendId", valFriendId);
        startActivity(objIndent);
        break;
    case 1:
        String valFriendId2 = friendId.getText().toString();
        controller.deleteFriend(valFriendId2);
        onResume();
    }

    return true;
}

@Override
public void onResume() {
    super.onResume();

    if (getListView() != null) {
        updateData();
    }
}

private void updateData() {
    EventController controller = new EventController(getActivity());
    HashMap<String, String> queryValues = new HashMap<String, String>();
    Intent objIntent = getActivity().getIntent();
    eventId = objIntent.getStringExtra("eventId");
    queryValues.put("eventId", eventId);
    SimpleAdapter adapter = new SimpleAdapter(getActivity(),
            controller.getAllFriends(queryValues),
            R.layout.view_friend_entry, new String[] { "friendId",
                    "friendName", "friendSpending" }, new int[] {
                    R.id.friendId, R.id.friendName, R.id.friendSpending });
    setListAdapter(adapter);
}

```

} 

Here is the code for expense list:

```
public class Expense extends ListFragment implements OnClickListener {

Button addexp;
TextView expenseId;
ListView lv;
String eventId, friendId;

public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    EventController controller = new EventController(getActivity());

    HashMap<String, String> queryValues = new HashMap<String, String>();
    Intent objIntent = getActivity().getIntent();
    eventId = objIntent.getStringExtra("eventId");
    queryValues.put("eventId", eventId);
    ArrayList<HashMap<String, String>> expenseList = controller
            .getAllExpenses(queryValues);
    if (expenseList.size() != 0) {
        lv = getListView();
        lv.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                expenseId = (TextView) view.findViewById(R.id.expenseId);
                String valExpenseId = expenseId.getText().toString();
                Intent objIndent = new Intent(getActivity(),
                        EditExpense.class);
                objIndent.putExtra("expenseId", valExpenseId);
                startActivity(objIndent);
            }
        });
        SimpleAdapter adapter = new SimpleAdapter(getActivity(),
                expenseList, R.layout.view_expense_entry, new String[] {
                        "expenseId", "expenseName","expenseQuantity" }, new int[] {
                        R.id.expenseId, R.id.expenseName, R.id.expenseQuantity });
        adapter.notifyDataSetChanged();
        setListAdapter(adapter);
    }
}

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.expense, container, false);
    addexp = (Button) rootView.findViewById(R.id.addexp);
    addexp.setOnClickListener(this);
    return rootView;

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent objIntent = new Intent(getActivity(), AddExpense.class);
    objIntent.putExtra("eventId", eventId);
    startActivity(objIntent);
}

@Override
public void onResume() {
    super.onResume();

    if (getListView() != null) {
        updateData();
    }
}

private void updateData() {
    EventController controller = new EventController(getActivity());
    HashMap<String, String> queryValues = new HashMap<String, String>();
    Intent objIntent = getActivity().getIntent();
    eventId = objIntent.getStringExtra("eventId");
    queryValues.put("eventId", eventId);
    SimpleAdapter adapter = new SimpleAdapter(getActivity(),
            controller.getAllExpenses(queryValues),
            R.layout.view_expense_entry, new String[] { "expenseId",
                    "expenseName", "expenseQuantity" }, new int[] { R.id.expenseId,
                    R.id.expenseName, R.id.expenseQuantity });
    setListAdapter(adapter);
}

```

}