Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to use LibGDX with Android, but instead of modifying my Activity to extend

AndroidApplication

I want my to render my graphics inside Android Fragment

The problem is that my class already extends Fragment, so I can't make it extend LibGDX AndroidApplication (Multiple Inheritance)

is there any workaround for this ?

Thanks

share|improve this question
    
You would probably just complicate things by taking out pretty much one of the core features of libgdx. Where does the need come from to make it so complex? –  Sidar Nov 25 '12 at 23:15
    
I need to display a 3D model in the fragment, then display some info in another view in the activity –  Mina Samy Nov 26 '12 at 7:58
    
If I'm not mistaken libgdx supports 3D rendering. Not sure though. –  Sidar Nov 26 '12 at 13:46
    
Seems like it's still in progess: libgdx.badlogicgames.com/features.html Sorry can't help you there =[ –  Sidar Nov 26 '12 at 15:51
    
Thanks Sidar for your help –  Mina Samy Nov 27 '12 at 7:56

2 Answers 2

I just made a pull request with the fragment feature implemented.

Instead of extending AndroidApplication by an activity, you can extend AndroidFragmentApplication by a Fragment and return initializeForView() on the onCreateView callback.

share|improve this answer
1  
Thanks a lot, maybe you want to share the url of your repo to help other users with this –  Mina Samy Feb 4 at 13:41
up vote 1 down vote accepted

Ok, after searching I got this solution:

instead of using a fragment I used a generic View to render my graphics in it:

game=new MyGdxGame(); 
View gameView=initializeForView(game,cfg);

this is how I was able to display other views in my activity

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.