Hello everyone i have a problem with my application onMarkerClick it works well till i click the marker second time the application crashes here is the code:

mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {


                        builder.setTitle("Set radius in meters:");
                        builder.setMessage("Info: The radius is set by default on 500 meters");

                        // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
                        input.setInputType(InputType.TYPE_CLASS_NUMBER);
                        builder.setView(input);

                        // Set up the buttons
                        builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                m_Text = Integer.parseInt(input.getText().toString());
                                Toast.makeText(getBaseContext(), "Radius set to: " + m_Text + " meters;", Toast.LENGTH_LONG).show();
                                circle.setRadius(m_Text);
                            }
                        });
                        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                            }
                        });

                        builder.show();
                        return false;
                    }
                });

The error is The specified child already has a parent. You must call removeView() on the child's parent first.
and the line is where return false is.

Recommended Answers

All 3 Replies

Anyone ?

Hard to say without seeing more of the code. Often the problem is how you inflate components or how you are discharging views once not need it. I would have to see more of the code, sorry

What part of code you need to see ? The other dialog boxes or ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.