• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 42
  • Last Modified:

Fragment beginTransaction

When I pass from Fragment to Fragment via beginTransaction, new Fragment is opening but  as well previous Fragment opening ?

How can ı close previous Fragment when Pass Second Fragment ?
0
Emre Metin
Asked:
Emre Metin
  • 2
  • 2
1 Solution
 
Chris HarteThaumaturgeCommented:
Your fragments are attached to an activity. If the main activity is not destroyed the fragments will keep on running, this is to allow you to back key through the fragments. If you want to prevent this behaviour you have to destroy the fragment with something like this

fragmentTransaction.remove(yourfragment).commit()

Open in new window

0
 
Emre MetinJr. Android DeveloperAuthor Commented:
Thank you.
0
 
Chris HarteThaumaturgeCommented:
If I have answered your question you may award the points and close it.
0
 
Emre MetinJr. Android DeveloperAuthor Commented:
good
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now