Last item from database not appearing in listview after adding the item
===

I have a dialogfragment which adds an item to the database and immediately shows it in the listview . 

The item added shows in the listview immediately but i don't know why the last item from the database doesn't appear . 
It appears after executing the activity showing listview again , but not just after adding the item through my dialog fragment .

Here is my dialog fragment code :

    public class AddMyItemDialog extends DialogFragment
      {
	private DatabaseHandler db;
	String nam, pri;
	static MyItem i;
	static int flag = 0;
	public List my = new ArrayList();
	
	
	public static AddMyItemDialog newInstance()
	{
		AddMyItemDialog f = new AddMyItemDialog();
		return f;
	}

	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		db = new DatabaseHandler(getActivity().getApplicationContext());
		setStyle(STYLE_NORMAL, android.R.style.Theme_Holo_Dialog_MinWidth);
	}

	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		View v = inflater.inflate(R.layout.additem_layout, container, false);
		getDialog().setTitle("Add New Item");
		
		final AutoCompleteTextView name = (AutoCompleteTextView)v.findViewById(R.id.autoCompleteTextView1);
		final EditText price = (EditText)v.findViewById(R.id.editText1);
		Button button1 = (Button)v.findViewById(R.id.save);
		Button button2 = (Button)v.findViewById(R.id.cancel);
		


		
		button1.setOnClickListener(new OnClickListener()
		{
            public void onClick(View v)
            {

            	nam = name.getText().toString();
            	pri = price.getText().toString();
            	//Toast t = Toast.makeText(null,nam+pri,Toast.LENGTH_SHORT);
        		
        		//t.show();
            	if((nam=="" || nam.isEmpty()) && (pri=="" || pri.isEmpty()))
            	{
            		Toast t = Toast.makeText(getActivity(),"Enter Details",Toast.LENGTH_SHORT);
            		t.show();
            	}
            	else if(pri=="" || pri.isEmpty())
            	{
            		Toast t = Toast.makeText(getActivity(),"Enter Unit Price",Toast.LENGTH_SHORT);
            		t.show();
            	}
            	else if(nam=="" || nam.isEmpty())
            	{
            		Toast t = Toast.makeText(getActivity(),"Enter Name",Toast.LENGTH_SHORT);
            		t.show();
            	}
            	else
            	{
            		i = new MyItem(nam, Double.parseDouble(pri));
                	db.addMyItem(i);
                	
                	flag = 1;
                	
                	MyActivity f = (MyActivity) getActivity().getFragmentManager()
                            .findFragmentByTag("my");
                	List<MyItem> l = db.getAllMyItem();
                	
                	my.clear();

            		for (MyItem i1 : l) {
            		     my.add(new LaundryList(i1.getName(),0));
            		}
                	
                	((MyListAdapter) f.getMyListAdapter()).setMyList(my);
                	f.getmyListAdapter().notifyDataSetChanged();
                	
                	getDialog().dismiss();
            	}
 


            }
        });
		
		

		
		button2.setOnClickListener(new OnClickListener()
		{
            public void onClick(View v)
            {
            	getDialog().dismiss();
            }
        });
		
		return v;
	}
	
}



and here's my fragment which shows the listview : 


    public class LaundryActivity extends Fragment
      {
        private ListView mListView;
         private DatabaseHandler db;
         List my = new ArrayList();
            MyListAdapter madapter ;

            //.....

            //.....
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
       {
       MyItem i;
       LinearLayout mylayout = (LinearLayout) inflater.inflate(R.layout.my_layout, container, false);

       List<MyItem> l = db.getAllMyItem();

       while(!l.isEmpty() )
       {
           i = l.get(0);
           l.remove(0);
           my.add(new MyList(i.getName(),0));
       }

       mListView = (ListView) mylayout.findViewById(R.id.list);
       madapter = new MyListAdapter(getActivity(), my);

       mListView.setAdapter(madapter);
       public ArrayAdapter getLaundryListAdapter() {
		// TODO Auto-generated method stub

	    return madapter;

	}

  }


