java - How to display data from a Loader using Toast -
i've simple activity (class mainactivity extends activity implements loadermanager.loadercallbacks<cursor>
)
also i've simple layout text box , button.
just keep simple, lets i've loader loads data hashmap<string>
(which populated) , i've intialized/configured loadermanager
, cursorloader
appropriately.
now i'd display content of hashmap using toast upon clicking on button, (which bound onclickretrievedata(){}
in activity
)
any hint on how that?
update: understand how display data on toast (once have data), question more of line of retrieving data loader inside onclicretrievedata().
it's hard tell whether you're asking how kickstart loader
loading or when done. if assume mean want start loading data when button clicked , calls onclickretrievedata()
, you'll this:
@override void onclickretrievedata(view v) { getloadermanager().initloader(my_loader_id, null, this); }
then, implementation of loadercallbacks.oncreateloader()
need create instance of loader
. framework kick off , run appropriately. when done, onloadfinished()
called , you'll have results. there can please: update adapter
, pop toast
, etc.
here's primer on loader
s may find helpful: http://po.st/xhovmf
Comments
Post a Comment