android - How to call an AsyncTaskLoader in constant intervall -
following situation:
i fetch data rest api using implementation of asynctaskloader. want update data in constant intervalls. approach first start loader in activity(getsupportloadermanager().initloader(0, null, mainactivity.this).forceload();
), instantiate timertask , pass activity (the 1 timertask instantiated at) , load data getsupportloadermanager().restartloader(0, null, mainactivity.this).forceload();
within run()
in timertask class.
problem: activitie's reference, don't call getsupportloadermanager()
, activitycontext.getloadermanager()
when trying activitycontext.getloadermanager()
, don't know correct third parameter.
is whole approach wrong? if so, way load data in constant intervalls?
Comments
Post a Comment