V
V
Vladislav Bukach2021-10-22 22:34:51
Java
Vladislav Bukach, 2021-10-22 22:34:51

How to make a button that would change the value of a boolean change in another activity?

There is this code where the marker on google maps is hidden

googleMap.addMarker(new MarkerOptions()
                    .position(new LatLng( 46.46838044481153, 30.71899689652372))
                    .title("КОПЕЙКА")
                    .snippet("and snippet")
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))
                    .visible(false));


How to make a button in another activity where .visible(false) gets the value true? And the marker appeared on the map.

I wrote it like a regular button but .visible is not supported please help

@Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        sub = (Button) view.findViewById(R.id.sub);

        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MarkerOptions.setVisible(true);
            }
        });
    }


Here is the xml code

<TextView
        android:id="@+id/vxod2"
        android:layout_width="90dp"
        android:layout_height="29dp"
        android:layout_centerHorizontal="true"
        android:text="Magaz"
        android:textColor="@color/white"
        android:textSize="24dp"
        android:translationY="120dp" />

    <ImageButton
        android:id="@+id/image_login_Button_sub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="8dp"
        android:background="@null"
        android:src="@drawable/btn_login"
        android:translationY="160dp"
        app:layout_constraintStart_toStartOf="parent"
        tools:ignore="SpeakableTextPresentCheck,SpeakableTextPresentCheck" />

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question