IllegalStateException: Fragment not added in ActionBarTabs example

by Ed Burnette » Fri, 20 May 2011 02:29:06 GMT


Sponsored Links
 While writing an app that uses Fragments and tabs on the Action Bar I
ran into a crash. I went back to the API Demos sample and can make the
same crash happen there. Start the program in the emulator and select
App > Action Bar > Action Bar Tabs. Click "Toggle tab mode" then "Add
new tab" twice, then click back and forth between the two tabs very
quickly until it crashes. Here's the traceback:


05-19 18:16:06.668: ERROR/AndroidRuntime(1153): FATAL EXCEPTION: main
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):
java.lang.IllegalStateException: Fragment not added:
TabContentFragment{407c55a8 #0 id=0x7f08000c Tab 1}
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.app.BackStackRecord.remove(BackStackRecord.java:366)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.example.android.apis.app.ActionBarTabs
$TabListener.onTabUnselected(ActionBarTabs.java:94)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.android.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:
476)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.android.internal.app.ActionBarImpl
$TabImpl.select(ActionBarImpl.java:816)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.android.internal.widget.ActionBarView
$TabClickListener.onClick(ActionBarView.java:954)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.view.View.performClick(View.java:3110)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.view.View$PerformClick.run(View.java:11928)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.os.Handler.handleCallback(Handler.java:587)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.os.Handler.dispatchMessage(Handler.java:92)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.os.Looper.loop(Looper.java:132)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
android.app.ActivityThread.main(ActivityThread.java:4025)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
java.lang.reflect.Method.invokeNative(Native Method)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
java.lang.reflect.Method.invoke(Method.java:491)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-19 18:16:06.668: ERROR/AndroidRuntime(1153):     at
dalvik.system.NativeStart.main(Native Method)
05-19 18:16:06.698: WARN/ActivityManager(82):   Force finishing
activity com.example.android.apis/.app.ActionBarTabs

Is this a known problem? I tried it under SDK Platform 3.0 (rev 1) and
3.1 (rev 2).

-- 



Re: IllegalStateException: Fragment not added in ActionBarTabs example

by Shane Isbell » Fri, 20 May 2011 02:46:46 GMT


 I've run into this on occasion, I surrounded it with a general Exception
catch to handle this, which seemed to have no side affects for my
application, as to whether this is platform bug, who knows? Without the
source code to look at, it is anyone's guess.

Shane





-- 


Sponsored Links


Other Threads

1. cupcake and Bluetooth status

Hello,

I'm lost with bluetooth specification: I read in this forum that
android support or not a2dp, avrcp, HFP, rSAP ...

With my previous mobile, I can access contacts, initialize a phone
call by voice, take or refuse a call in my car which has bluetooth.

Now if have a HTC Magic, my car can make pairing with my phone but I
can't make a phone call from my car, neither access to my contact
list.

Did I miss something in the configuration ? Do I have to install an
app ?

Thanks for your help.
Regards.

--~--~---------~--~----~------------~-------~--~----~

2. XML Layout Specification

Here's a layout from the DevGuide: 
http://developer.android.com/guide/topics/ui/declaring-layout.html

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:orientation="vertical" >
   <TextView android:id="@+id/text"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="Hello, I am a TextView" />
   <Button android:id="@+id/button"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="Hello, I am a Button" />
</LinearLayout>

- What does xmlns mean?
- What is the android:xxx sytnax all about?
- What does the "http://schemas.android.com/apk/res/android" do?
- Are there other values I might choose?  (ex. "http://
schemas.android.com/apk/res/iPhone")
- Can you create your own Layouts like the "LinearLayout"?
- Is there a list of available components like "Button", "TextView"?
- What does the @, the / and the + symbol do?
- Can I edit this directly in Eclipse with a graphical editor rather
than editing the xml text?

That's a lot of questions.  So let me sum these up into one simple
question:

Does anyone know a link to the specification for the XML Layout
Language for Android?

Thanks for any hints for a complete newbie.

--~--~---------~--~----~------------~-------~--~----~

3. Displaying stored images

4. I'm not able to receive more than two GPS position. The application hangs.

5. Browser Porting for Android

6. binaries for omap3530

7. Why pick off the ANIMATE_SCREEN_LIGHTS in the @141571?