This question may sound a little silly and unusual, but pardon me, as I haven't been able to figure out the reason behind the problem. Just a simple case, I start a non UI fragment from onCreate method of an activity, everything works fine. But if I put the same code inside onCreateOptionsMenu callback for the activity, the fragment is not created (Verified it through logs). So, the question arises if there's a certain callback in an activity that I should use to commit fragment transactions.
The code for fragment transactions (try in a sample project) :
Fragment frag;
frag = new DownloadFragment();
FragmentTransaction fr = getFragmentManager().beginTransaction();
fr.add(frag, "FR");
fr.commit();
where DownloadFragment is a non UI fragment in which I return null from onCreateView.
Any help would be appreciated, as I have gone through the developer docs for Fragment already.