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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:42:03+00:00 2026-06-09T05:42:03+00:00

I have a main Activity and it has two fragments, ListFramgment and DetailFragment. In

  • 0

I have a main Activity and it has two fragments, ListFramgment and DetailFragment.
In ListFragment, on the event of selecting a choice, I am making a query to database which will return an array. I am passing this array to DetailFragment.

public void onListItemClick(ListView l, View v, int position, long id) {
    String selectedStore = (String) getListAdapter().getItem(position);
    DetailFragment fragment = (DetailFragment) getFragmentManager()
            .findFragmentById(R.id.detailFragment);
    if (fragment != null && fragment.isInLayout()) {
        TestAdapter mDbHelper = new TestAdapter(getActivity());
        mDbHelper.createDatabase();
        mDbHelper.open();

        Cursor curItemList = mDbHelper.getItemList(selectedStore);
        String[] itemList = new String[curItemList.getCount()];
        int i = 0;
        while(curItemList.moveToNext()){
            String item = curItemList.getString(0);
            itemList[i] = item;
            i++;
        }


        mDbHelper.close();

        fragment.setText(itemList);

        //getItemList(selectedStore);



    }

Here is DetailFragment code:

    public class DetailFragment extends android.app.ListFragment {

//   String qty;
//   String pr;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e("Test", "hello");
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.details, container, false);
        return view;
    }

    public void setText(final String[] itemList) {
        ListView view = (ListView) getView().findViewById(R.id.detailsText);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                android.R.layout.simple_list_item_1, itemList);
        view.setAdapter(adapter);
}

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);
        Toast.makeText(null, "time for popup", Toast.LENGTH_SHORT).show();
    }

As the application starts, it is crashing and the LogCat is:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.click4tab.fragmentvogella/com.click4tab.fragmentvogella.MainActivity}: android.view.InflateException: Binary XML file line #14: Error inflating class fragment
  • 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-09T05:42:04+00:00Added an answer on June 9, 2026 at 5:42 am
    Binary XML file line #14: Error inflating class fragment
    

    check your Layout xml file there are something mistake at line no.14.

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

Sidebar

Related Questions

This has been killing me for two days now. I have a main Activity
This has been killing me for two days now. I have a main Activity
I have two activities. One activity has the main game and the other activity
I am making an app in which i have a main activity that the
I am making an android app. I have a main activity and i want
I have two activities, one is main and I have another activity called Test
I have two inner fragments in a activity. Activity is called: MainFragmentActivity (extends FragmentACtivity)
I have two Activities: Activity A and Activity B: 'A' is my Main Activity,
Good day. I have an app that has one main activity which holds 3
I have 3 activity in my application. My first activity (Main) has 2 button

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.