How to move from one fragment to another fragment on click of a ImageView in Android? -


I have an image view. I want to move one piece from one piece to another with one click of the imageview Just as we can move from one activity to another.

  intent = new intent (main activity; this, SecondActivity.class); startActivity (i);   

How can I do this? Can anyone explain me step by step?

My codes are as follows: mycontacts.class

  public squares expansion of my contacts fragment {public micrank () {} @ Override Public View Creatives (LayoutInflator Inflator, View Group Container, Bundle Saved InstantState) {Final View v = Super. Gateview (position, convertview, parent); ImageView Purple = (ImageView) v.findViewById (R.id.imageView1); Purple.setOnClickListener (New OnClickListener) {@Override Click Public Zero (see V) {// TODO Auto-Generated Method Stub / How to Break Work From Here}}}); Return view; }}   

taskss.class

  extends the fragment of public square works {public work () {} @ View override public view view (Layout Inflighter Inflator, View Group Container, Bundle Saved InstantState) {see View = Inflator.Flat (R.Let.fragment_layout_On, Container, False); Return view; }}    

  click on the purple link (New Onclick () { @ Override public section onClick (see v) {piece slice = new function (); piece manager's piece manager = getActivity (). GetSupportFragmentManager (); Piece transaction piece transaction = Piece Manager.beginTransaction (); Piece Transaction.replace (R .id.content_frame, fragment; fragmentTransaction addToBackStack (empty); fragmentTransaction.commit ();}});   

You write the above code ... We are replacing RIDContent_frame with our piece. Hope it helps you

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -