fragment tab host - Android : passing parameters to a tab -


in android app, use following code create tabs :

mtabhost = (fragmenttabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup(this, getsupportfragmentmanager(), r.id.realtabcontent); mtabhost.addtab(mtabhost.newtabspec("simple").setindicator("simple"),             myfragment.class, null); 

in addtab method, third parameter bundle object , null. use third parameter pass parameters fragment ?

the android api documentation empty addtab , not document parameter.

the answer yes. parameters passing in bundle later set fragment arguments , can accessed getarguments inside fragment.

the code makes happen in fragmenttabhost :

newtab.fragment = fragment.instantiate(mcontext,                         newtab.clss.getname(), newtab.args); 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -