D
D
dnpgk2019-06-16 20:48:13
Java
dnpgk, 2019-06-16 20:48:13

How to change the visibility of a button in one activity through another activity?

I have two activities - Activity1 and Activity2. Activity1 is just an empty sheet with an invisible button button (its invisibility is set via xml markup). The activity code is shown below.

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lessons);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(this);
}

What should be written in Activity2, which has the below condition check instead of dots, to make the button in Activity1 visible? Tell me please.
if (a[0] >4*x[0]){
...
...
...
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Denis Zagaevsky, 2019-06-16
@dnpgk

1) do not use activities for this, use fragments;
2) if you really want to, use startActivityForResult + onActivityResult. Activity instances should not see each other under any circumstances. So "changing visibility in another activity", no matter how simple it may seem, is impossible.

S
Stalker_RED, 2017-08-02
@MegaPuxapb

The easiest way is a background image or svg.

E
Exploding, 2017-08-03
@Exploding

+1 to Stalker_RED 's answer , especially since it seems to be so in the example. Only two pictures: a line separator (which is circled in red) and a block separator (between numbers), then the list down will be dynamic.

A
Artem Vedishchev, 2017-08-03
@Artem-V

I suggest you cut it all into cells, you get a 9 x 5 field and fill the curve in pieces with the background. Text under numbered position: absoute. Curve between lines - one block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question