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..
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.
精彩评论