Android Question Finishing various activitys

MarianoD

Member
Licensed User
Longtime User
First all, apologize for my english.

I have activity1, activity2 and activity3...
In activity1 and activity2 i have EditText to ask some info to user.

A button in activity1, save editetext info in variables, and then i make startactivity(activity2)

Activity2 has more edittext, and a button... when i press this button i save this info in variables, and make startactivity(activity3)

I do know how to finish the current activity, with activity.finish, but my question is:

How can from inside activity3, finish activity 1 and 2?

Activity3 has a confirmation button... i save all info to database.. and want user go to FIRST screen, buuuut when i finish activity3 (activity.finish) obviusly the user go to activivity2 :(

Hope you understand me.

Thanks.
 

DonManfred

Expert
Licensed User
Longtime User
In act1 when calling act2

Activity.finish
Startactivity(act2)

Same in act2 when starting act3


You cannot finish an activity other than the running one
 
Upvote 0

MarianoD

Member
Licensed User
Longtime User
Thanks for quick reply!

I have declared variables in both act1 and act2 that i use in act3 confirmation button... and i also need the user to move from act3 to act2... or from act2 to act1... to review data entered, using back key.

So i suppose if i use act1.finist before open act2, then i lost act1 values, its correct?

I need some way to finish act1 and act2 from inside act3 when user confirm data anda i save to database, its posible?

Thanks again.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You should declare the variables in Process_Globals in the first Activity.
Why do you have 1 EditText in Activity1, others in Activity2 and a confirmation in Activity3.
Can't this be done in one Activity ?
You could post your project as a zip file so we could see what exactly you want to do.
 
Upvote 0

MarianoD

Member
Licensed User
Longtime User
I have some edittext in act1 and others in act2 because i grouped similar info, and because they are a lot of edittext that i need to use, and in cell phone the small screen dont allow me to put all editttext in one unique activity.

Maybe, as you say, i need to declare all variables in first activity (now i have some variables in act1 and some variables in act2) and close each activity before open new one, and keep edittext info in those variables, and if this variables has values, then load into esittext when user goes back and forward throgh activitys, before confirm...

But, anyway, can i close an activity from other activity? there is some kind of : app.activities.finish("act2) ?
I will try... Thanks.
 
Upvote 0

MarianoD

Member
Licensed User
Longtime User
Ok Klaus, i will try to declare variables on process_globals of first activity, and then store and use this variables when user move through activitys.

Thank you very much!
 
Upvote 0

MarianoD

Member
Licensed User
Longtime User
Thank you, i use global variables and set edittext from variables, and finish each activity before open de next, and works great!
 
Upvote 0
Top