I have a PopUpMenu list, when i click on the menu i should refresh my Ui and display the updated data from database.
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 && result.equalsIgnoreCase(myContext.getResources().getString(R.string.showdist))) 
        {
            showPopupSearchPref(myContext, activity);
        }    
        else if (result != null && 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);
}
my issue is when first time i click the menu ,the page refreshing but not data, again if i click the second time its refreshing and getting data.. I'am struck any help is appreciated
 
     
    