Make sure you are including 'android-support-v4.jar' in your project
and are extending the "FragmentActivity" class, not "Activity".

-Dan

On Mar 5, 7:29 am, Alessio Grumiro <[email protected]> wrote:
> I've, also, attended this tutorialhttp://goo.gl/i45OXwith same error.
>
> 03-05 14:26:57.266: ERROR/AndroidRuntime(401): Uncaught handler: thread main
> exiting due to uncaught exception
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401): java.lang.RuntimeException:
> Unable to start activity
> ComponentInfo{com.example.fragmenttest/com.example.fragmenttest.FragmentTes 
> tActivity}:
> android.view.InflateException: Binary XML file line #13: Error inflating
> class fragment
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread.access$2200(ActivityThread.java:119)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.os.Looper.loop(Looper.java:123)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread.main(ActivityThread.java:4363)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 
> 860)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> dalvik.system.NativeStart.main(Native Method)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401): Caused by:
> android.view.InflateException: Binary XML file line #13: Error inflating
> class fragment
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.inflate(LayoutInflater.java:407)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.inflate(LayoutInflater.java:320)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.inflate(LayoutInflater.java:276)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.jav 
> a:198)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.Activity.setContentView(Activity.java:1622)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> com.example.fragmenttest.FragmentTestActivity.onCreate(FragmentTestActivity 
> .java:18)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     ... 11 more
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401): Caused by:
> java.lang.ClassNotFoundException: android.view.fragment in loader
> dalvik.system.PathClassLoader@44e83988
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> java.lang.ClassLoader.loadClass(ClassLoader.java:573)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> java.lang.ClassLoader.loadClass(ClassLoader.java:532)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.createView(LayoutInflater.java:466)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayo 
> utInflater.java:66)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     at
> android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
> 03-05 14:26:57.395: ERROR/AndroidRuntime(401):     ... 20 more
>
> 2011/3/5 Alessio Grumiro <[email protected]>
>
>
>
>
>
>
>
> > Can you give me another sample app, please?
>
> > 2011/3/4 Dianne Hackborn <[email protected]>
>
> > If it helps, ApiDemos has all of the same fragment samples as the ones
> >> originally released for HC, but using this library.  You can run them from
> >> "App/Fragment Support" in the UI, and the code is the Fragment*Support.java
> >> files that are right next to the existing ones for the HC framework.
>
> >> Also be sure to look at the source for FragmentActivity.java, which has
> >> some documentation in the class java doc giving an overview.
>
> >> On Fri, Mar 4, 2011 at 8:53 AM, Dan Watling 
> >> <[email protected]>wrote:
>
> >>> To get the example working, I just had to manually copy the 'android-
> >>> support-v4.jar' from '/extras/android/compatibility/v4' into the libs
> >>> folder of the project as well as add it to the build path.
>
> >>> Lessons I've learned in the past few hours while playing with this:
> >>>  - Ensure all of your activities that you want to take advantage of
> >>> this API extend FragmentActivity
> >>>  - Ensure you are using the 'android.support.v4.app.' versions of the
> >>> Fragment API and not 'android.app'.
>
> >>> -Dan
>
> >>> On Mar 4, 10:30 am, Premier <[email protected]> wrote:
> >>> > I always have below error
>
> >>> > 03-04 17:29:01.800: ERROR/AndroidRuntime(448): Caused by:
> >>> > java.lang.ClassNotFoundException: android.view.fragment in loader
> >>> > dalvik.system.PathClassLoader@44e83790
>
> >>> > On 4 Mar, 16:52, Alessio Grumiro <[email protected]> wrote:
>
> >>> > > Ok, but it must be executed on HoneyComb (look at default.properties
> >>> > > target=android-11).
>
> >>> > > I'm unable to lunch it on android 1.6.
>
> >>> > > Is the library for android 1.6?
>
> >>> > > 2011/3/4 marlan <[email protected]>
>
> >>> > > > under
>
> >>> $android-sdk/extras/android/compatibility/v4/samples/ApiDemos/src/com/
> >>> > > > example/android/apis/app/
> >>> > > > all that extends FragmentActivity (FragmentLayoutSupport.java for
> >>> > > > example).
>
> >>> > > > On 4 Mrz., 16:32, Premier <[email protected]> wrote:
> >>> > > > > Where did you found example, please?
>
> >>> > > > > I need it.
>
> >>> > > > > Thank you.
>
> >>> > > > > On 4 Mar, 15:04, marlan <[email protected]> wrote:
>
> >>> > > > > > Ok, I found the samples that uses the compatibility packages
> >>> > > > > > (FragmentDialogOrActivitySupport etc.).
> >>> > > > > > I changed the base class from FragmentLayout to FragmentLayout
> >>> extends
> >>> > > > > > FragmentActivity and now it works.
>
> >>> > > > > > On 4 Mrz., 13:31, marlan <[email protected]> wrote:
>
> >>> > > > > > > Hi,
> >>> > > > > > > I'm trying to use the new fragment library in an 1.6 app.
> >>> > > > > > > I have copied the FragmentLayout.java and the
> >>> fragment_layout.xml
> >>> > > > from
> >>> > > > > > > the Apidemos and the android-support-v4.jar in my project.
> >>> > > > > > > Everything compiled but when I run the app I get an
> >>> exception:
> >>> > > > > > > java.lang.ClassCastException:
> >>> > > > my.package.FragmentLayout$TitlesFragment
> >>> > > > > > > cannot be cast to android.app.Fragment.
> >>> > > > > > > (The my.package.FragmentLayout$TitlesFragment extends
> >>> > > > > > > android.support.v4.app.Fragment)
> >>> > > > > > > How can I use the library?
> >>> > > > > > > The APIDemos that comes with the compatibility package seems
> >>> to use
> >>> > > > > > > only the honeycomp Api.
> >>> > > > > > > Thanks Mark
>
> >>> > > > --
> >>> > > > You received this message because you are subscribed to the Google
> >>> > > > Groups "Android Developers" group.
> >>> > > > To post to this group, send email to
> >>> [email protected]
> >>> > > > To unsubscribe from this group, send email to
> >>> > > > [email protected]
> >>> > > > For more options, visit this group at
> >>> > > >http://groups.google.com/group/android-developers?hl=en
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Android Developers" group.
> >>> To post to this group, send email to [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/android-developers?hl=en
>
> >> --
> >> Dianne Hackborn
> >> Android framework engineer
> >> [email protected]
>
> >> Note: please don't send private questions to me, as I don't have time to
> >> provide private support, and so won't reply to such e-mails.  All such
> >> questions should be posted on public forums, where I and others can see and
> >> answer them.
>
> >>  --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers" group.
> >> To post to this group, send email to [email protected]
> >> To unsubscribe from this group, send email to
> >> [email protected]
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to