android - Change Activities' Fragment Inside the Fragment -


i have activity, inside activity have fragment.
fragment have onclick method supposed to
change view.
want change view inside using onclick method inside the
fragment , use same activity.
enter image description here

so far can do.

fragment mfragment = null;         class fragmentclass;         fragmentclass = loginsignup.class;         try {             mfragment = (fragment) fragmentclass.newinstance();         } catch (exception me) {             log.e(tag, me.tostring());         }          fragmentmanager mfragmentmanager = getsupportfragmentmanager();         mfragmentmanager.begintransaction().replace(r.id.framelayout, mfragment).commit();   

use below method

public static void openfragment(fragmentmanager manager, fragment targetfragment) {      try {          string fragmentname = targetfragment.getclass().getname();         manager.popbackstack();         manager.begintransaction()                 .replace(r.id.framelayout, targetfragment, fragmentname)                 .addtobackstack(fragmentname)                 .commit();      } catch (exception e) {         e.printstacktrace();     }  } 

call method each time when opening fragment. have pass 2 params method. targetfragment fragment want open.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -