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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:12:13+00:00 2026-06-03T12:12:13+00:00

well I’m starting to understand Android Fragments but this is still confusing for me.

  • 0

well I’m starting to understand Android Fragments but this is still confusing for me. I need a little help. As it says android fragments is supported since API level 11 but you can download “support.v4” libraries pack for lower level APIs. Well first I create new project to try fragments on API level 15. Then I did the same with API level 8 and it does not work… I imported external jar and it sees all needed import as it should… What seems to be the problem here?

Here is my main class:

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

public class Fragment2Activity extends FragmentActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

My main layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

        <fragment 
   android:name="com.frag.Fragment2.frag"
   android:id="@+id/frag"
   android:layout_width="match_parent"
   android:layout_height="match_parent" />

</LinearLayout>

My fragment class:

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class frag extends Fragment {
       @Override
       public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View v = inflater.inflate(R.layout.hello_fragment, container, false);
          return v;
       }
    }

And my fragment layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TextView
   android:layout_width="fill_parent"
   android:layout_height="match_parent"
   android:text="THIS IS FRAGMENT"
   android:background="@drawable/ic_launcher"
/>

</LinearLayout>

FIXED

  • 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-06-03T12:12:15+00:00Added an answer on June 3, 2026 at 12:12 pm

    You are still using the android.view.fragment class, which does not exist. You have to switch to android.support.v4.app.fragment on older devices.

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

Sidebar

Related Questions

Well this is incredibly frustrating. After being nagged by Rails that I need to
Well I think this is kinda dumb but, I wonder if there's any way
Well, first I know that this question was already asked several times. But I
Well friends, I have got this query which works but is very long for
well i have a configuration like this in the components part of my config
Well, I have a application which somehow requires some system resources, but how do
Well, I was trying to fix this program, and I keep getting the errors
Well, i have the following need: create 3 dropdownlist with dependencies. My table in
Well I created a jquery mobile form but the every element is in a
Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running

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.