Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to add fragment dynamically in view-pager

I have an activity which fetches the data from server and on result success, I have a parameter for fragments which I need to add dynamically.

FragmentManager fm1 = MainActivity.this.getSupportFragmentManager();

FragmentTransaction ft1 = fm1.beginTransaction();

frag = new Animal_Activity();

ft1.replace(R.id.activity_main_content_fragment, frag);


ft1.commit();

Comments