开发者

How to implement Back button functionality

开发者 https://www.devze.com 2023-02-17 08:13 出处:网络
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

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..


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();


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消