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 7417717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:45:08+00:00 2026-05-29T07:45:08+00:00

Possible Duplicate: Exception right off the bat I’m trying to use a dashboard fragment

  • 0

Possible Duplicate:
Exception right off the bat

I’m trying to use a dashboard fragment on my main page after installing Action Bar Sherlock. I’m getting the error:

“Error inflating class fragment”

I’ve installed Action Bar Sherlock as a library project. Here is the XAML:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<Fragment 
    class="myVirtualHealthCheck.com.Android.fragments.DashboardFragment"
    android:layout_width="fill_parent"
    android:layout_height="0dip"/>

</LinearLayout>

aMainMenu.java

package myVirtualHealthCheck.com.Android.ui;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;

import myVirtualHealthCheck.com.Android.R;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;


public class aMainMenu extends FragmentActivity{

DashboardFragment.java:

    package myVirtualHealthCheck.com.Android.fragments;

    import myVirtualHealthCheck.com.Android.R;
    import myVirtualHealthCheck.com.Android.ui.aNutritionLookup;
    import myVirtualHealthCheck.com.Android.ui.aPlaces;
    import myVirtualHealthCheck.com.Android.ui.aVitalAdd;
    import myVirtualHealthCheck.com.Android.ui.aVitalsMy;
    import myVirtualHealthCheck.com.Android.utils.AnalyticsUtils;
    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.ViewGroup;


    public class DashboardFragment extends Fragment {

    public void fireTrackerEvent(String label) {
        AnalyticsUtils.getInstance(getActivity()).trackEvent("Home Screen Dashboard", "Click", label, 0);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_dashboard, container);

        // MY VITALS *CLICK*
        root.findViewById(R.id.btnVitalsMy).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("VitalsMy");
                startActivity(new Intent(getActivity(), aVitalsMy.class));
            }
        });

        // ADD VITAL *CLICK*
        root.findViewById(R.id.btnVitalAdd).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("VitalAdd");
                startActivity(new Intent(getActivity(), aVitalAdd.class));
            }
        });

        // NUTRITION *CLICK*
        root.findViewById(R.id.btnNutrition).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("NutritionLookup");
                startActivity(new Intent(getActivity(), aNutritionLookup.class));                
            }
        });

        // PLACES *CLICK*
        root.findViewById(R.id.btnPlaces).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("Places");
                startActivity(new Intent(getActivity(), aPlaces.class));                
            }
        });

        // TWITTER *CLICK*
        root.findViewById(R.id.btnTwitter).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("Twitter");
                startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://twitter.com/#!/WellnessCheck")));                
            }
        });

        // Facebook *CLICK*
        root.findViewById(R.id.btnFacebook).setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                fireTrackerEvent("Facebook");
                startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://www.facebook.com/myvhc")));                
            }
        });



        return root;
    }
}

here is the logcat:

02-01 08:53:01.014: W/dalvikvm(8023): threadid=1: thread exiting with uncaught exception (group=0x40020950)
02-01 08:53:01.114: E/AndroidRuntime(8023): FATAL EXCEPTION: main
02-01 08:53:01.114: E/AndroidRuntime(8023): java.lang.RuntimeException: Unable to start activity ComponentInfo{myVirtualHealthCheck.com.Android/myVirtualHealthCheck.com.Android.ui.aMainMenu}: android.view.InflateException: Binary XML file line #8: Error inflating class Fragment
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.os.Looper.loop(Looper.java:123)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at java.lang.reflect.Method.invokeNative(Native Method)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at java.lang.reflect.Method.invoke(Method.java:521)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at dalvik.system.NativeStart.main(Native Method)
02-01 08:53:01.114: E/AndroidRuntime(8023): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class Fragment
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.support.v4.app.FragmentActivity.setContentView(FragmentActivity.java:421)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at myVirtualHealthCheck.com.Android.ui.aMainMenu.onCreate(aMainMenu.java:32)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-01 08:53:01.114: E/AndroidRuntime(8023):     ... 11 more
02-01 08:53:01.114: E/AndroidRuntime(8023): Caused by: java.lang.ClassNotFoundException: android.view.Fragment in loader dalvik.system.PathClassLoader[/data/app/myVirtualHealthCheck.com.Android-1.apk]
02-01 08:53:01.114: E/AndroidRuntime(8023):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.createView(LayoutInflater.java:466)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
02-01 08:53:01.114: E/AndroidRuntime(8023):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
02-01 08:53:01.114: E/AndroidRuntime(8023):     ... 19 more
  • 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-29T07:45:09+00:00Added an answer on May 29, 2026 at 7:45 am

    Jake Wharton’s solution described in his comment worked:

    Solution: use lowercase ‘f‘ (i.e., <fragment .. NOT <Fragment …)

    So I changed <Fragment> to <fragment>.

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

Sidebar

Related Questions

Possible Duplicate: Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupporte d major.minor version 51.0) i
Possible Duplicate: Exception in thread “main” java.lang.NoSuchMethodError: main My main syntax is correct. What
Possible Duplicate: Causes of 'java.lang.NoSuchMethodError: main Exception in thread “main”' i got this error
Possible Duplicate: Exception in thread “main” java.lang.NoSuchMethodError: main I am fairly new to Java,
Possible Duplicate: Causes of 'java.lang.NoSuchMethodError: main Exception in thread “main”' I am using Eclipse.
Possible Duplicate: Does a exception with just a raise have any use? Is there
Possible Duplicate: catch exception by pointer in C++ I always catch exceptions by value.
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: Should I derive custom exceptions from Exception or ApplicationException in .NET? I've
Possible Duplicate: Why catch and rethrow Exception in C#? I've been scouring the net

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.