how to open custom dialog box in a custom dialog box in android

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago


my app contains a custom dialog box on button click in which i have some check boxes on selecting one of this check box it show me another dialog box with 3 check boxes plz help me here is my code for opening first dialog box

ImageView img1 = (ImageView)findViewById(R.id.image_menu);
        img1.setOnClickListener(new OnClickListener() {

              @Override
              public void onClick(View arg0) {

                // custom dialog
                final Dialog dialog = new Dialog(MainActivity.this);
                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dialog.setContentView(R.layout.menu);

                Button dialogButton = (Button) dialog.findViewById(R.id.btncross);
                // if button is clicked, close the custom dialog
                dialogButton.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                });

                 dialog.show();
                 Spinner spin = (Spinner)dialog.findViewById(R.id.spinState);
                 ArrayAdapter<String> adapter_state = new ArrayAdapter<String>(MainActivity.this,  android.R.layout.simple_spinner_item, states);
                 adapter_state.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                 spin.setAdapter(adapter_state);
                 spin.setSelection(pos);
                 spin.setOnItemSelectedListener(MainActivity.this);



                 Button btnShare = (Button)dialog.findViewById(R.id.btnShare);
                 btnShare.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View arg0) {
                        // TODO Auto-generated method stub
                        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
                        sharingIntent.setType("text/plain"

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.