Prototik / HoloEverywhere

NO LONGER MAINTAINED. DEVELOP FOR 4.X+ DUDE.
MIT License
2.18k stars 608 forks source link

[Can be deleted]Can't use fragments with holoeverywhere #818

Closed ArnoutCreemers closed 10 years ago

ArnoutCreemers commented 10 years ago

I've been struggling using fragments with holoeverywhere. I've tried everything. I am trying to do the following:

Fragment fr = getFragmentManager().getFragment(savedInstanceState, "fragment_top");

This gives me the following error: Type mismatch: cannot convert from android.support.v4.app.Fragment to org.holoeverywhere.app.Fragment Which I understand, as 'fr' is an instance of org.holoeverywhere.app.Fragment, and getFragment() gives me an android.support.v4.app.Fragment.

using the following won't work either: Fragment fragment=getActivity().getSupportFragmentManager().getFragment(savedInstanceState, "fragment_top");

But how to use fragments then? I've used the following imports:

import org.holoeverywhere.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction;

There aren't any fragmentManager libraries in HoloEverywhere I understand? Then how would I call getFragmentManager() using holoeverywhere?

I really don't understand.

BraisGabin commented 10 years ago

Does your Fragment extend org.holoeverywhere.app.Fragment? I don't think so. The problem isn't in the Activity. It's in your Fragment.

And please:

  1. If it's an issue report like a issue: the problem & how to reproduce it.
  2. If it's a question use StackOverflow.
ArnoutCreemers commented 10 years ago

My Fragment does extend org.holoeverywhere.app.Fragment while my Activity extends org.holoeverywhere.app.Activity. getSupportFragmentManager().getFragment() will always return an android.support.v4.app.Fragment while I don't need this... I need a org.holoeverywhere.app.Fragment. Am I calling the wrong method or is it a bug..?

I guess I should have posted it on StackOverflow, indeed. I'm sorry for that. But as I couldn't find anything about this I figured it might could be a bug?

BraisGabin commented 10 years ago

No problem, the next time you will report in the right place ;).

If I understand properly you have a compilation problem, not a CastCassException, right? Did you try this?:

Fragment fragment = (Fragment) getActivity().getSupportFragmentManager().getFragment(savedInstanceState, "fragment_top");
ArnoutCreemers commented 10 years ago

Well, that actually does seem to solve the problem. Which is weird because I'm sure I had tried this before and then, it didn't work.. So it's not a bug and just my mistake.

Thanks for your help. This topic may be removed :-)