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

The Archive Base Latest Questions

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

I am developing an Android app using fragments and would like the user to

  • 0

I am developing an Android app using fragments and would like the user to be able to pick an image for scanning purposes. I have a fragment that allows the user to select their desired source (camera, hand-drawn, or gallery). When the user selects Gallery, then another fragment should display the image. I already know how I am supposed to get the image into an ImageView but keep getting this error with the Fragments:

12-10 17:30:26.405: E/AndroidRuntime(6560): FATAL EXCEPTION: main
12-10 17:30:26.405: E/AndroidRuntime(6560): java.lang.RuntimeException: Unable to resume activity {org.nathanmoos.artificialIntelligence.clockreader/org.nathanmoos.artificialIntelligence.clockreader.ChooseSourceActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2241)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2256)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.os.Looper.loop(Looper.java:130)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.ActivityThread.main(ActivityThread.java:3835)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at java.lang.reflect.Method.invokeNative(Native Method)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at java.lang.reflect.Method.invoke(Method.java:507)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at dalvik.system.NativeStart.main(Native Method)
12-10 17:30:26.405: E/AndroidRuntime(6560): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.view.ViewGroup.addViewInner(ViewGroup.java:1976)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.view.ViewGroup.addView(ViewGroup.java:1871)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.view.ViewGroup.addView(ViewGroup.java:1828)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.view.ViewGroup.addView(ViewGroup.java:1808)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:848)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1053)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1371)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:499)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.Activity.performStart(Activity.java:3791)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.Activity.performRestart(Activity.java:3821)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.Activity.performResume(Activity.java:3826)
12-10 17:30:26.405: E/AndroidRuntime(6560):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2231)
12-10 17:30:26.405: E/AndroidRuntime(6560):     ... 10 more

Basically it looks like there’s an issue with my FragmentTransaction usage. Here’s my code:

frag = new GalleryFragment();
frag.setImagePath(imagePath);

FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
tx.replace(R.id.fragment_space, frag);
tx.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

and my layout file:

   <FrameLayout 
       android:id="@+id/fragment_space"
       android:layout_width="0dp"
       android:layout_height="match_parent"
       android:layout_weight="65"/>
  • 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-27T10:21:09+00:00Added an answer on May 27, 2026 at 10:21 am

    Never mind I figured this one out. It’s the same solution as:

    Android Fragment (with Compatibility Package on 2.3.3) creates "Specified child already has a parent error"
    and
    Error swapping / adding an XML Fragment
    .

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

Sidebar

Related Questions

I am developing an Android app on windows, using eclipse. I would like to
I have project where i'm developing an Android App using a lot of existing
I am developing a Android app using Jquery Mobile/Phonegap. I have the following code
I'm in the process of developing an Android app. I have been able to
I'm currently developing an Android application that fetches images using http requests. It would
I'm in the middle of developing android app using google map. My question is
Hi I am developing an Android app using an EditText, and a add en
I'm developing a Android app using Phonegap - Is there any way in which
Hi I am developing an Android App where I require a user to authenticate
I am developing an android app. for mathematical calculations. There I have some buttons

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.