Android Question How to come back the activity after give the finish activity? (When Click Back space button)

Pravee7094

Active Member
Hi all,
I have a two activity. One is dashboard and another one is change password.
In dash board, Click the change password button then go to change password activity.
B4X:
Private Sub btn_changepassword_Click
    StartActivity(change_password)
    Activity.Finish
End Sub

Now In the change password activity, Click the back space button It will go to Main menu. But I want to go dashboard activity.
I know, I have a change to remove activity.finish . If I remove the activity.finish Then It does not updated properly.

Any suggestion or Help?

Thanks
Praveen
 

Cableguy

Expert
Licensed User
Longtime User
Hi all,
I have a two activity. One is dashboard and another one is change password.
In dash board, Click the change password button then go to change password activity.
B4X:
Private Sub btn_changepassword_Click
    StartActivity(change_password)
    Activity.Finish
End Sub

Now In the change password activity, Click the back space button It will go to Main menu. But I want to go dashboard activity.
I know, I have a change to remove activity.finish . If I remove the activity.finish Then It does not updated properly.

Any suggestion or Help?

Thanks
Praveen
Make the property you want to change, a public property and when the change_password activity is closed (it's called whenever the activity goes to the background) update the necessary property
 
Upvote 0

wes58

Active Member
Licensed User
Longtime User
Hi all,
I have a two activity. One is dashboard and another one is change password.
In dash board, Click the change password button then go to change password activity.
B4X:
Private Sub btn_changepassword_Click
    StartActivity(change_password)
    Activity.Finish
End Sub

Now In the change password activity, Click the back space button It will go to Main menu. But I want to go dashboard activity.
I know, I have a change to remove activity.finish . If I remove the activity.finish Then It does not updated properly.

Any suggestion or Help?

Thanks
Praveen
You don't need Activity.Finish in your dashboard Activity if it is main Activity!
Remove Activity.Finish from your Sub btn_changepassword_Click
Then, if in change_password Activity, you call Activity.Finish it will go back to the activity you called change_password from - i.e. dashboard Activity
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Sorry, but I have to disagree
That's fine. Different people see things differently.

Handling a single activity can be difficult.
Handling multiple activities can be very difficult.
Handling B4XPages with any number of pages is simple.
This is how it relates to this question.

Switching to B4XPages is not complex at all.
 
Upvote 0

wes58

Active Member
Licensed User
Longtime User
That's fine. Different people see things differently.

Handling a single activity can be difficult.
Handling multiple activities can be very difficult.
Handling B4XPages with any number of pages is simple.
This is how it relates to this question.

Switching to B4XPages is not complex at all.
There is one limitation (at least one that I know of) - support of multiple orientations.
As you wrote before "Bottom line: most users should use the default B4XPages. If there is any specific "page" that needs to be displayed in other orientation or support multiple orientations, then you can use an additional activity outside of B4XPages."
I don't limit my applications to one orientation, so B4XPages are not for me. That's why I wrote, that that answer didn't answer the question!
 
Upvote 0

wes58

Active Member
Licensed User
Longtime User
This is not your thread. I didn't respond to your posts.
The OP didn't mention anything about orientation.

If you have any question then start a new thread. If you want to comment about my answers then start a new thread as well.
Sorry if you feel offended.
You did respond to my post #7!
In my opinion, the response shouldn't serve only the OP, It should serve other people that may come across this problem. Writing that using b4xPages is the best solution is not correct as I explained in post #8
You are right, the OP didn't mention anything about orientation. So, if you want to be so critical about my responses - where did the OP mention b4xPages?
Anyway, have a nice day. I am too old for that.
 
Upvote 0

Albert Kallal

Active Member
Licensed User
Click the back space button It will go to Main menu. But I want to go dashboard activity.
I know, I have a change to remove activity.finish . If I remove the activity.finish Then It does not updated properly.

Any suggestion or Help?

Thanks
Praveen

That dashboard should re-plot due to the "resume" event. So yes, I would remove the activity.finish. You start the password.activty. When user hits back, then the previous activity - (really does not matter) should resume.

So your dashboard routines + view + activity? Just move ("MOST") of your code from activity create to that of Resume event.

now the form and activity flow becomes quite easy.

When you start the password activity (and I assume it has a view). You do whatever. The previous activity will pause for you. Now a simple back button will close down your password activity and the previous one will "resume". So as a general design approach? Move "most" of the display and startup code of your dashboard to the resume event - not the create event. (the load of the view of course remains in create event.

So when you start that password activity - you don't really need or want to stop or pause or do anything with the current dashboard activity - nothing at all is required - it will pause and then resume when you close the password activity.

I VERY much admire how this whole process works - and if done right, then next to no effort is really required on your part.

As noted, we are trending towards not having to deal with this event process, but you can well leverage the event model to your favor and advantage if done right.

R
Albert
 
Upvote 0
Top