Wednesday, 15 August 2012

android - How can I close the fragment? -


I have a piece on the activity I piece button. If I click on the button, the piece should be closed. How has this been done?

  increases the public class ItemFragment slice {Private ImageView btnApply; Private Click Button Click Button = New Click Button (); @ Override Public View Crate View (LayoutInstallter Inflator, View Group Container, Bundle Saved InstantState) {View Routview = Inflator.In Flat (R.Let.Eteam_Info, Container, Falls); BtnApply = (ImageView) rootView.findViewById (R.id.btnSendItem); BtnApply.setOnClickListener (clickButton); Return root view; } See the private class Apply ClickButton. OnClickListener {@Override Public void onClick (see v) {if (R.id.btnSendItem == v.getId ()) {Toast.makeText (getActivity (), "CLOSE", Toast.LENGTH_LONG). Return; }}}}}  

There is no such thing as this piece Close , but you can delete the fragment from the stack by clicking the button at the bottom to pop the list

  getActivity () . GetFragmentManager (). BeginTransaction (). Remove (this) .commit ();  

No comments:

Post a Comment