RAAAAM
RAAAAM

Reputation: 3380

How to implement Back button functionality

I have 3 different activity namely, category,sub_category and list of items. In sub_category i created back button using intent Activity. Back button in list_of items should be focus to sub_category. i dont know how to do this.. pls guide me..

Upvotes: 4

Views: 4005

Answers (2)

Sunil Pandey
Sunil Pandey

Reputation: 7102

from category activity call

Intent it=new Intent(category.this,sub_category.class)
startActivityForResult(it);

similarly

Intent it=new Intent(sub_category.this,list_item.class)
startActivityForResult(it);

and in onClickListener of back button simply finish your activity like

list_item.this.finish();

Upvotes: 6

Atmaram
Atmaram

Reputation: 3785

for going back to previous screen u can call finish() in your current activity. It will remove the current activity from activity Stack and take you to the previous one.

Upvotes: 0

Related Questions