Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Fragments Introducing Fragments Adding Fragments to Activities

bruce chin
PLUS
bruce chin
Courses Plus Student 12,206 Points

Why is my Android app stuck on loader image?

hi, i am using Android Studio 2.1.1. i followed all the steps, but when i run the emulator (native emulator on Android Studio or Genymotion) all it get is the loader image going round and round.. i tried on OS 5 and 6

Alex Londono
Alex Londono
2,033 Points

@Bruce Chin I got the same problem... Sucks to see after 7 months there has not been an answer :(

Error: E/EGL_emulation: tid 2728: eglSurfaceAttrib(1165): error 0x3009 (EGL_BAD_MATCH)

even i got the same error...

Sachin Jayaram
Sachin Jayaram
5,461 Points

Make sure you guys are using android.app imports and not android.support imports. This might be the issue you guys are facing.

3 Answers

hey i found the answer instead of creating object of ListFragment in main activity we have to create object of FragmentList class which we have created and pass that object

my java class is FragmentList so what i have done is

FragmentList list = new FragmentList(); . . .

fragmentTransaction.add(R.id.placeHolder,list); . .

Emily Conroyd
Emily Conroyd
6,512 Points

In my activity.main I have this as my code. But please provide what you have in your listfragment.java as well.

ListFragment fragment = new ListFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(R.id.placeholder, fragment); fragmentTransaction.commit();

There is no such class named FragmentList All i can find is ListFragment which was deprecated in API level 28

Derek Copeland
PLUS
Derek Copeland
Courses Plus Student 679 Points

I'm getting the same loading spinner upon loading the app whether I use the app or support libraries. Looking for a solution...

The ListFragment used in MainActivity.java has to be the same one as the one made in previous video. Since the ListFragment.java is in the same package, it does not need to be imported.

For some reason Android Studio tools had imported one of the ListFragment objects from the android libraries, and removing it fixed the issue for me - so anyone still having up with this issue should make sure to check if there is import android.support.v4.app.ListFragment or import android.app.ListFragment in their MainActivity class and remove it.