Skip to content

Instantly share code, notes, and snippets.

@arussellsaw
Created June 16, 2015 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arussellsaw/38d28bf7c032f2c6eaf7 to your computer and use it in GitHub Desktop.
Save arussellsaw/38d28bf7c032f2c6eaf7 to your computer and use it in GitHub Desktop.
Android Fragments not being fragments?
class MarkerDetails extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.marker_details, container, false);
}
}
class SomeActivity extends FragmentActivity {
public void newMarker(View view) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
MarkerDetails markerDetails = new MarkerDetails();
fragmentTransaction.add(R.id.map_container, markerDetails); //MarkerDetails is not an instance of Fragment ?!?!
fragmentTransaction.commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment