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

  • SEARCH
  • Home
  • 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 7019071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:08:07+00:00 2026-05-27T23:08:07+00:00

I am trying to inflate a layout containing a Fragment using the backwards compatibility

  • 0

I am trying to inflate a layout containing a Fragment using the backwards compatibility package and SDK level 10. I took the jar file and placed it in the libs folder of my project. I extended FragmentActivity.

It all works perfectly when I run at API level 11 on an XLarge screen device.

When I drop back to compiling against level 10, and running on a normal sized screen, I get failure at the point where it create a new Activity and inflate the fragment in it.

Caused by:
java.lang.ClassNotFoundException:
android.view.fragment in loader
dalvik.system.PathClassLoader[/data/app/com.motoappsummitagenda-1.apk]
04-01 01:07:14.311 2870 2870 E
AndroidRuntime: at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)

So it looks like something, somewhere is looking for android.view.fragment, and not the compatibility version, android.support.v4.app.Fragment. Of course, android.view.fragment won’t be found on API level 10. But where is that android.view.fragment coming from?

The XML that is being inflated is

<?xml version="1.0" encoding="utf-8"?>
<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:name="com.motorapp.SessionFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/sessionfragment">
</fragment>

The code for it starts:

package com.motorapp;

import java.util.List;
import java.util.ListIterator;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.support.v4.app.*;
import android.support.v4.util.*;
import android.support.v4.*;
import android.support.v4.widget.*; 

public class SessionFragment extends android.support.v4.app.Fragment {

The symptoms are similar to this problem, but I don’t have those mistakes
inflating fragments with compatibility package android

The android.compatibility.v4.android-support-v4 jar file is on my build path in Eclipse
under Project > Properties > Java build path

I have in the manifest (and I have tried different variations of the name).

In getting started with fragments, I first used API 11 on a honeycomb device, and that all works perfectly. It is in getting the same code (modified to use the slightly different compatibility API) working with the compatibility library that I have this problem. Any ideas would be very welcome. Thanks,
Peter

  • 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-27T23:08:08+00:00Added an answer on May 27, 2026 at 11:08 pm

    I had the same wrong class problem with the compatibility library and tried everything mentioned above with no luck. I finally figured it out: I was using the incorrect XML element Fragment rather than correct one fragment. Capitalization seems to matter.

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

Sidebar

Related Questions

I am trying to inflate more than one progress bar in a layout.Please tell
Trying to create a custom component that gets it's layout from an XML file
I'm trying to inflate an custom alertdialog and encountered something strange. layout = inflater.inflate(R.layout.call_or_sms_dialog,(ViewGroup)findViewById(R.id.contacts));
Trying to inflate a Button code: LinearLayout ll = (LinearLayout)this.getLayoutInflater().inflate(R.layout.assets, null); Button btn =
I'm trying to create a layout with a ViewFlipper containing ScrollViews. The idea is
I am trying to put some views into a Fragment using a LayoutInflater. They
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I am trying to inflate an ImageView that scales a Drawable that I can
Using the following code snippets, I'm trying to get the text value which has
I am trying to display the list of songs using array adapters. But the

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.