0

There is a listener code.

Method onCreate:

rssListView.getViewTreeObserver().addOnGlobalLayoutListener(
    new ViewTreeObserver.OnGlobalLayoutListener() {
        public void onGlobalLayout() {        
            //Then it stops
            rssListView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
    }
);

I want to run it again, when the button clicked:

b1.setOnClickListener(
    new View.OnClickListener() {
        // @Override
        public void onClick(View v) {
            // ...
        }
    }
);

Tell me how I can activate the listener on the button?

Max Usanin
  • 2,390
  • 5
  • 34
  • 64

2 Answers2

0

What is it you want to run again.

If you want the function to be called on button click then do the function call in the onClick method of the listener. Once a listener is added to a UI Widget it keeps on listening to any UI Events on that object till the application is running.

Errol Dsilva
  • 177
  • 11
0

I think you talking about Pull-to-Refresh functionality. If yes - look at this article.

Community
  • 1
  • 1
Dmytro Zarezenko
  • 10,010
  • 9
  • 52
  • 95