Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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 ?


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: 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
up vote 2 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

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
Thanks a lot, maybe you want to share the url of your repo to help other users with this – Mina Samy Feb 4 '14 at 13:41

Your Answer


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.