private Timer createSearchTextTimer() {
    Timer timer = new Timer();
    timer.schedule(
        new TimerTask() {
          @Override
          public void run() {
            onSearchTextTimerTriggered();
          }
        },
        0,
        searchTextTimerDelayInMilliseconds);

    return timer;
  }
 private void onSearchTextTimerTriggered() {
   if (hasSearchTextChangedSinceLastQuery) {
     Handler handler = new Handler(Looper.getMainLooper());
     handler.post(
         new Runnable() {
           @Override
           public void run() {
             FacebookException error = null;
             try {
               loadData(true);
             } catch (FacebookException fe) {
               error = fe;
             } catch (Exception e) {
               error = new FacebookException(e);
             } finally {
               if (error != null) {
                 OnErrorListener onErrorListener = getOnErrorListener();
                 if (onErrorListener != null) {
                   onErrorListener.onError(PlacePickerFragment.this, error);
                 } else {
                   Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error);
                 }
               }
             }
           }
         });
   } else {
     // Nothing has changed in 2 seconds. Invalidate and forget about this timer.
     // Next time the user types, we will fire a query immediately again.
     searchTextTimer.cancel();
     searchTextTimer = null;
   }
 }