Android:How do i refresh my data
<p>I have a <code>PopUpMenu</code> list, when i click on the menu i should <em>refresh</em> my Ui and display the <em>updated</em> data from <strong>database</strong>.</p>

<pre><code>public void DoAction(View v, Activity activity, final AlertDialog alert) 
{

        Context myContext = v.getContext();

        PopUpMenu popUpMenu = (PopUpMenu) v.getTag();
        String result = popUpMenu.getMenuName();
        if (result != null &amp;&amp; result.equalsIgnoreCase(myContext.getResources().getString(R.string.showdist))) 
        {
            showPopupSearchPref(myContext, activity);
        }    

        else if (result != null &amp;&amp; result.equalsIgnoreCase(myContext.getResources().getString(R.string.syncnow))) 
        {

            Synchronization sync = new Synchronization(v.getContext());
            sync.initiatePushSync(Calendar.SECOND, 0);
            sync.initiatePullSync(Calendar.SECOND, 0);
            Constants.Data = ((myPreferences) myContext.getApplicationContext()).getAllAttractions(true,Constants.field, Constants.order);          
            activity.finish();
        }
}

public void initiatePullSync(int calenderType, int time)
{
        Calendar newTime = Calendar.getInstance();
        newTime.add(calenderType, time);
        Log.d(TAG, "Syncronisation Device - Cloud " + newTime.getTime());

        if(Constants.syncPull == null)
        {
            Constants.syncPull = new Intent(context, PullFavourite.class);
            Log.d(TAG, "Syncronisation Device - Cloud Creating New Intent");
        }

        PendingIntent sender = PendingIntent.getBroadcast(context, Constants.syncPullFavPlaceId, Constants.syncPull, PendingIntent.FLAG_CANCEL_CURRENT);
        AlarmManager am = (AlarmManager)context.getSystemService(context.ALARM_SERVICE);
        am.set(AlarmManager.RTC_WAKEUP, newTime.getTime().getTime(), sender);
        Log.d(TAG, "Syncronisation Device - Cloud Reschedule after " + time + calenderType);
}
</code></pre>

<p>my issue is when <em>first time</em> i click the menu ,the <strong>page refreshing but not data</strong>, again if i click the <em>second time</em> its <strong>refreshing and getting data</strong>.. I'am struck any help is appreciated</p>
