Getting PackageManager


On page 357, there is a code sample to detect matching activities for an action:

PackageManager pm = getPackageManager(); ...

This code will work find if you are calling this from an Activity. But since we are doing it from a Fragment, you need to use:

PackageManager pm = getActivity().getPackageManager(); ...

I think you would also have to move your intent to be member variables of