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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:53:02+00:00 2026-06-05T16:53:02+00:00

I have class that extend FragmentActivity in it I add fragment to layout as

  • 0

I have class that extend FragmentActivity in it I add fragment to layout as following

public class maincontrolActivity extends FragmentActivity  {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maincontrol);

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

}


}

the Ounit is look like

public class oUnit  extends Fragment {
         View view = inflater.inflate(
                R.layout.chemounit,
                container,
                false);

///// my other code

 return view;
}

oCreateView in Ounit I try to add progress bar like

     ProgressDialog connectionProgressDialog = new ProgressDialog( getActivity());
      connectionProgressDialog.setCancelable(false);
      connectionProgressDialog.setCanceledOnTouchOutside(false);
      connectionProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      connectionProgressDialog.setMessage("Uploading Leads...");
      connectionProgressDialog.show();

but it never show

I have in this fragement list I path to its constructor context using view.getContext()

I try to display AlertDialog

                AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext());
                final EditText input = new EditText(v.getContext());
               alert.setView(input);
               alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int whichButton) {

                  //     Toast.makeText(getApplicationContext(), s_spin_text,
                        //       Toast.LENGTH_SHORT).show();


                   }
           });

            alert.setNegativeButton("Cancel",
          new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int whichButton) {
                           dialog.cancel();
                   }
                   });
           alert.show();

is this problems due to this line

     View view = inflater.inflate(
                R.layout.chemounit,
                container,
                false);

if yes ? how to replace it

Best regards

  • 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-05T16:53:04+00:00Added an answer on June 5, 2026 at 4:53 pm

    I think that to do this you should use: DialogFragment.

    There you have method OnCreateDialog()
    and there you can put your code:

    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
      final ProgressDialog connectionProgressDialog = new ProgressDialog( getActivity());
      connectionProgressDialog.setCancelable(false);
      connectionProgressDialog.setCanceledOnTouchOutside(false);
      connectionProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      connectionProgressDialog.setMessage("Uploading Leads...");
      connectionProgressDialog
      return connectionProgressDialog;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that extends android.app.Dialog, the layout is done in an xml
I have a fragment class that extends Fragment and calls setHasOptionsMenu to participate in
I have class that extends another class, that extend another class.. and so on.
I have Mainactivity which extend FragmentActivity ,I am loading fragment in layout using LinearLayout
I have a class PlaylistTrack that I want to extend class Song. When I
I have a class that extends AsyncTask , which fetches the gps cordinates from
I have a class that extends Application. The class is fairly extensive. When the
I have a class that extends View. I override the onDraw method and allow
i have a class that extends another. when i iterate the current object i
I have a class that extends AsyncTask. In the doInBackground() method, I connect 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.