android - Call another fragment from a card using cardlib -


I am using a card to apply the card. When I click on a card, that piece should be included in it and the second piece should be loaded, is it possible?

  Public square miccard card with a custom inner layout expands [/ ** * constructor * * @ ultimate reference * / public miccard (reference reference) {this (reference, r. Latte card_layout); } / ** * The ultimate reference * @ Ultimate Internal Layout * / Public Miccard (Reference Reference, Int LaLayout) {Super (Reference, Interior Layout); in this(); } / ** * Init * / private void init () {// set no header // An OnClickListener listener setOnClickListister (@Override Click on Public Zero (Card Card View View) {Toast. Make Text (GetContext), "Click on Listener Card", Toast. LNNHHLF). Show (); // Here}}); }   

Here, I want to call Fragment Manager and change the whole piece with each other, I think it should be done within the activity, but how? This structure is the structure, which has the card holding activity, the pieces kept

Here is the answer: I get an example of main activity through the constructor.

  Public Miccard (Reference Reference, Intail Layout) {Super (context, internal layout); MActivity = (MainActivity Reference); in this(); } Private Zero init (// Set an OnClickListener Listener SetOpenClickList (New OnCardClicklist) {@Override Public Zero (click on the card card, see the view) {Toast., GetContext, "Click the listener card" , Toast LENGTH_LONG). Show (); Basefragment = new Elder CallStatragment (); mActivity.openFragment (basefragment);}}); }   

I called the method in the main activity to make fragment transactions:

  Public Null Fraudragment {ifForFragment! = Null} {Piece Transaction Feet = getFragmentManager (). BeginTransaction (); Ft.replace (R.id.fragment_main, baseFragment); Ft.commit (); If (baseFragment.getTitleResourceId ()> 0) mCurrentTitle = baseFragment.getTitleResourceId (); }}   

Then it works fine.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -