Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional Android 4 Application Development
|
BOOK: Professional Android 4 Application Development
This is the forum to discuss the Wrox book Professional Android 4 Application Development Reto Meier; ISBN: 978-1-1181-0227-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2013, 12:25 PM
Registered User
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Earthquake example fragment inflation error

I am getting an error when I run the example from the book. The error in the LogCat is "Error inflating class fragment".

I see that the method used in chapter 6 is different from the ToDoList example earlier in the book. Chapter six uses the simple_list_view_1 and does not have a layout associated with the fragment. The code in my project matches the downloaded code, and I have removed all the guts for the stream and am trying to just get the layouts to display on the emulator.

Help is appreciated.
Steve
 
Old November 27th, 2013, 12:55 PM
Registered User
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to find the right error in the LogCat

I did some poking around in the LogCat, and saw at the bottom of the error list the error "Cannot be cast to android.app.Fragment".

I took this error into Google and found a response that said;

If I had to guess, ...[fragment class] is extending android.support.v4.app.Fragment. However, [activity] is not extending android.support.v4.app.FragmentActivity...

I looked at the fragment class and I was importing android.support.v4.app, but the main activity was importing android.app

I changed the fragment class' import to be android.app and all is well now.
Steve





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 Earthquake 2, Earthquake.java, error onActivityResult dbomberg BOOK: Professional Android 2 Application Development 2 November 30th, 2012 05:52 AM
Chapter 9 - Earthquake - TimerTask Error IAmCorbin BOOK: Professional Android 2 Application Development 2 November 2nd, 2010 04:50 PM
Chapter 10 Earthquake 2 - Live Folder error MellowFellow BOOK: Professional Android 2 Application Development 1 September 13th, 2010 02:41 PM
chapter 5 Earthquake EricTapia BOOK: Professional Android 2 Application Development 2 April 14th, 2010 12:47 AM
Updating XML file w/ XmlWriter throws ConformanceLevel.Fragment error allenj47 XML 0 September 13th, 2009 12:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.