Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6216989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:20:48+00:00 2026-05-24T07:20:48+00:00

I keep getting this error when trying to run this code…. 07-31 10:53:40.840: ERROR/AndroidRuntime(22962):

  • 0

I keep getting this error when trying to run this code….

07-31 10:53:40.840: ERROR/AndroidRuntime(22962): Caused by: java.lang.ClassCastException: com.fttech.shoppingClass cannot be cast to android.support.v4.app.Fragment
 07-31 10:53:40.840: ERROR/AndroidRuntime(22962):     at android.support.v4.app.Fragment.instantiate(Fragment.java:325)
07-31 10:53:40.840: ERROR/AndroidRuntime(22962):     at android.support.v4.app.Fragment.instantiate(Fragment.java:300)

and

07-31 10:50:10.650: ERROR/AndroidRuntime(22917): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f070020 type #0x12 is not valid
07-31 10:50:10.650: ERROR/AndroidRuntime(22917):     at android.content.res.Resources.loadXmlResourceParser(Resources.java:2054)
07-31 10:50:10.650: ERROR/AndroidRuntime(22917):     at   android.content.res.Resources.getLayout(Resources.java:853)
07-31 10:50:10.650: ERROR/AndroidRuntime(22917):     at android.view.LayoutInflater.inflate(LayoutInflater.java:389)







public class shopping_details_fragment extends Fragment{

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

    //Return the view for our WebView
    return(inflater.inflate(R.id.shoppingWindow,container, false)); //This is where the error is pointing too

}

}

Here is the fragment xml i am inflating too…

<fragment android:layout_height="match_parent" android:id="@+id/shoppingWindow" class="com.fttech.shopping_details_fragment" android:layout_width="match_parent"></fragment>

What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:20:48+00:00Added an answer on May 24, 2026 at 7:20 am

    As far as I understand Fragments, you need to think of this as an Activity. Thus, it appears that you are trying to inflate a fragment with inflater.inflate(R.id.shoppingWindow,container, false). Rather, you should be inflating the layout for the fragment, not the fragment itself. So something like inflater.inflate(R.layout.shoppingWindowLayout, container, false), just as you would inflate the layout for an activity.

    As for the cast exception, what does shoppingClass extend? Make sure you have the correct import statements. You are using the compatibility library so your import statements for fragments should be from that rather than the fragments built in to Android. For example, you should have android.support.v4.app.Fragment and probably android.support.v4.app.FragmentActivity rather than android.app.Fragment. That might be the source of the cast exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error while trying to modify some tables. Here's my code:
Im trying to display this listview, but I keep getting a: 07-17 21:14:22.233: ERROR/AndroidRuntime(349):
Hi i'm trying to run Nant but keep getting this error when i tried
So I keep getting this error when trying to compile C++ code using CodeBlocks.
Keep getting this error after inserting a subdatasheet into a query and trying to
I am trying to do a terminal update and I keep getting this error,
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
While trying to host the CLR, I keep getting this: error C2440: 'function' :
Im trying to use Date Formatters (NSDateFormatter), but I keep getting this error: Program
Trying to install pear package and keep getting this strange error. Can you shed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.