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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:18:18+00:00 2026-06-08T04:18:18+00:00

I have Mainactivity which extend FragmentActivity ,I am loading fragment in layout using LinearLayout

  • 0

I have Mainactivity which extend FragmentActivity ,I am loading fragment in layout using

LinearLayout formLayout = (LinearLayout)findViewById(R.id.mainLayout);
        formLayout.removeAllViews();


          FragmentTransaction fragmentTransaction =      fragmentManager.beginTransaction();


         Search fragment = new  Search(maincontrolActivity.this);

          fragmentTransaction.add(R.id.mainLayout,fragment , "MY_FRAG");
          fragmentTransaction.commit();

in PatientSearch I call apoointementsearch (another fragment) by using

startActivity(new Intent(Search.this.getActivity(), AppointementSearch.class).putExtra("Position",0));

but it crashs giving this log ,I am sure that I put them in the AndroidManifest

07-18 17:13:15.780: E/AndroidRuntime(3579): FATAL EXCEPTION: main
07-18 17:13:15.780: E/AndroidRuntime(3579): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.appnetics/com.appnetics.AppointementSearch}: java.lang.InstantiationException: com.appnetics.AppointementSearch
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread.access$500(ActivityThread.java:122)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.os.Looper.loop(Looper.java:132)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread.main(ActivityThread.java:4123)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at java.lang.reflect.Method.invokeNative(Native Method)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at java.lang.reflect.Method.invoke(Method.java:491)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at dalvik.system.NativeStart.main(Native Method)
07-18 17:13:15.780: E/AndroidRuntime(3579): Caused by: java.lang.InstantiationException: com.appnetics.AppointementSearch
07-18 17:13:15.780: E/AndroidRuntime(3579):     at java.lang.Class.newInstanceImpl(Native Method)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at java.lang.Class.newInstance(Class.java:1301)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.Instrumentation.newActivity(Instrumentation.java:1025)
07-18 17:13:15.780: E/AndroidRuntime(3579):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
07-18 17:13:15.780: E/AndroidRuntime(3579):     ... 11 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-06-08T04:18:21+00:00Added an answer on June 8, 2026 at 4:18 am

    Simply to add a fragment you just need an instance of Fragment,

    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    Search fragment = new  Search();
    fragmentTransaction.add(R.id.mainLayout,fragment , "MY_FRAG");
    fragmentTransaction.commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an activity ( MainActivity.java ) in which content view is like this
I have a mainActivity which is Customer.java with listview of 5 diff. activities. I
I have a mapview class which extends MapActivity. The code i'm using follows the
I have an app using fragments, all of which are contained in a single
I have implemented a thread in android which refresh the fragment (some text list
i have main activity in which i have Four menus. and i have one
I am making an app in which i have a main activity that the
I have a Tabhost which is my main activity. When a tab is clicked
My Application has 3 activities (MainActivity,SampleActivity,TempActivity) and Application have to start from MainActivity because
I have an activity, I'll call it mainactivity for now. And I want to

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.