Dilemma: when to use Fragments vs Activities:

I know that Activities are designed to represent a single screen of my application, while Fragments are designed to be reusable UI layouts with logic embedded inside of them. Until not long ago, I developed an application as it said that they should be developed. I created an Activity to represent a screen of my … Read more

onActivityResult is not being called in Fragment

The activity hosting this fragment has its onActivityResult called when the camera activity returns. My fragment starts an activity for a result with the intent sent for the camera to take a picture. The picture application loads fine, takes a picture, and returns. The onActivityResult however is never hit. I’ve set breakpoints, but nothing is … Read more

How do popBackStack() and replace() operations differ?

replace() does 2 things: Remove currently added fragment (A) from the container (C) you indicated Add new fragment (B) to the same container These 2 operations are what is saved as a Backstack record / transaction. Note that fragment A remains in created state, and its view is destroyed. Now popBackStack() reverses your last transaction that you’ve added to BackStack. … Read more