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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:37:02+00:00 2026-05-27T12:37:02+00:00

I have the following code in an Activity that starts a dialog for a

  • 0

I have the following code in an Activity that starts a dialog for a layout that contains a fragment.

...
case R.id.pick_resource:
        dialog = new Dialog(this);
        dialog.setContentView(R.layout.resource_picker);
        dialog.setCancelable(true);
        dialog.setTitle("Pick a resource");
        dialog.show();

This works very well the first time after application start, but when the dialog is quit and later called again, I get this stack trace:

08-10 10:47:33.990: ERROR/AndroidRuntime(26521): FATAL EXCEPTION: main
        android.view.InflateException: Binary XML file line #7: Error inflating class fragment
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:688)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:224)
        at android.app.Dialog.setContentView(Dialog.java:449)
        at org.rhq.pocket.StartActivity.onOptionsItemSelected(StartActivity.java:118)
        at android.app.Activity.onMenuItemSelected(Activity.java:2390)
        at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:852)
        at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:153)
        at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:956)
        at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:174)
        at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:85)
        at android.view.View.performClick(View.java:3100)
        at android.view.View$PerformClick.run(View.java:11644)
        at android.os.Handler.handleCallback(Handler.java:587)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:126)
        at android.app.ActivityThread.main(ActivityThread.java:3997)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:491)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
        at dalvik.system.NativeStart.main(Native Method)
        Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate id 0x7f090007, tag null, or parent id 0xffffffff with another fragment for org.rhq.pocket.ResourcePickerFragement
        at android.app.Activity.onCreateView(Activity.java:4089)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:664)
        ... 24 more

Any idea, what may cause this exception? Do I have to unload the fragment somehow?

  • 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-27T12:37:03+00:00Added an answer on May 27, 2026 at 12:37 pm

    Does the fragment in your layout have an android:id attribute?

    I suspect this is because the fragment is instantiated each time your layout is inflated, the first time the ID isn’t being used, but the second time the FragmentManager still thinks your Fragment is alive, so the ID is considered a duplicate.

    Try removing the android:id attribute from your fragment if it exists, or add a placeholder layout such as a framelayout and use a fragmenttransaction to dynamically add the fragment each time your dialog is created.

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

Sidebar

Related Questions

I have a main activity that launches a child activity using the following code:
I have following code class User attr_accessor :name end u = User.new u.name =
I have following code snippet that i use to compile class at the run
I have an Activity that opens the Camera and starts a preview on a
Hi I have a Broadcast receiver with following code. 1. Intent i = new
I have the following code in my activity. In my xml, the video view
I have following goal: From a list in main activity that extends ListActivity, I
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
I have following code in my application: // to set tip - photo in

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.