Как добавить инфобоксы к маркерам с Kotlin, где пользователи могут добавлять текст? - PullRequest
0 голосов
/ 02 июля 2018

Я хотел бы добавить инфобоксы, чтобы показывать над маркерами клики, где пользователи могут писать текст и сохранять его в базе данных, чтобы другие пользователи могли его просматривать. Как это сделать с Kotlin?

Вот мой маркерный код:

override fun onMapReady(googleMap: GoogleMap) {
    mMap = googleMap
    // Do other setup activities here too, as described elsewhere in this tutorial.

    // Turn on the My Location layer and the related control on the map.
    updateLocationUI()

    // Get the current location of the device and set the position of the map.
    getDeviceLocation()







                //PRESSING WILL ADD MARKER
                mMap.setOnMapClickListener(GoogleMap.OnMapClickListener { point ->
                    val builder: AlertDialog.Builder
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        builder = AlertDialog.Builder(this, android.R.style.Theme_Material_Dialog_Alert)
                    } else {
                        builder = AlertDialog.Builder(this)
                    }
                    val marker = MarkerOptions().position(point)


                    builder.setTitle("Are you sure you want to add a map location here?")


                                . setPositiveButton (android.R.string.yes, DialogInterface.OnClickListener { dialog, which ->
                            mMap.addMarker(marker)
                                    //CUSTOM MARKER
                                    .setIcon(BitmapDescriptorFactory.fromResource(R.mipmap.pinetree_foreground))


                        })

                        .setNegativeButton(android.R.string.no, DialogInterface.OnClickListener { dialog, which ->
                            // do nothing
                        })
                                .show()

                        true


                    }
...