android - Calling a function in a currently displayed fragment from Application -


i hav fragment in mainactivity displays loading pic of now, while call function in xmlreader application class mainactivity itself. xmlreader uses asynctask read xml file online server. after execution, need alert fragment shows loading pic refresh else. question how alert displayed fragment? or atleast alert activity can call different fragment.

read somewhere putting broadcast listener overkill, way?

if want access current visible item in viewpager:

// activity int position = mviewpager.getcurrentitem(); fragment currentitem = msectionspageradapter.getitem(position); 

if want callback activity fragment:

// call custom method update() in activity fragment ((mainactivity) getactivity()).update(); 

Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -