How To Make A Button Visible Frominvisible On A Successful Event Happend In Another Activity
I have buttons V1-V8 visible and R1-R8 invisible initially in my activity_main.xml file My MainActivity.java file package com.example.buttonvtor; import com.example.buttonvtor.Mai
Solution 1:
In your main Activity use startActivityForResult instead of startActivity. This allows you to return a value from the new Activity to the Main Activity. For example:
In main Activity
startActivityForResult(newIntent(MainActivity.this,Payment3Activity.class), 3);
Here, number 3 is a number you define that allows you to identify the result later. In your Payment#Activity you would have at some point (for example when you disimiss your Activity)
setResult(RESULT_OK); // or any result you wantThe result is sent to the MainActivity, and you must override onActivityResult() to get the result.
protectedvoidonActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == 3) // here you match the number you sent in startActivityForResultif (resultcode == RESULT_OK)
// do something
}
Solution 2:
You can start the second Activity with startActivityForResult() and catch the result in your first activity in onActivityResult() like e.g. here.
Post a Comment for "How To Make A Button Visible Frominvisible On A Successful Event Happend In Another Activity"