android - onCreateLoader() only called one time -
I have a piece that increases ListFragment and implements LoaderManager.LoaderCallbacks. Inside this piece I have a button that should call the website and fill the list.
The problem is this method which is called only once, only when the piece is made, and I will be called every time that I press the button:
@overराइड Public loader & lt; List & lt; ResultSearchUser & gt; & Gt; OnCreateLoader (int arg0, bundle arg1) {new search options Task back (getActivity (), page, size); }
This is my button:
@ Override public view creatives (LayoutEfter Influator, View Group Container, Bundle Saved InstantState) {... Button ButtonSchurch == (button) Amliner layout. FindVibIID (R.Button SQLSUsers); Button SearchUsers.setOnClickListener (New View.OnClickListener () {@Override Click Public Zero (see V) {if (user.getInterests)! = Null & user.getInterests (). Size ()> 0) {Page ++; GetLoaderManager (). InitLoader (0, blank, SearchFragment.this);}}}); ....
Why is the Creeded Loder () called only when the piece is made? And why is the method loaded () called every time that I press the button? What is the correct way to call your work and fill the list?
Thank you in advance.
From
:
Ensures that a loader is started and active is. If the loader is not already present, one has been made and the loader starts (if the activity / piece is currently started). Otherwise, the last built loader is reused.
In other words, initLoader ()
will trigger the call on onCreateLoader ()
when loader
Not already made, later on the call, loader
will be reused.
If you need to force / delete an existing loader
, you should call LoaderManager # restartLoader ()
.
Comments
Post a Comment