The difference between the action button and the back button

What is the difference between the actionBar button and the Android feedback button? Since it seems that the back button is an ActionBar called with:

ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); 

it works better ...

For example: when I press the ActionBar return button, the animations are there, but if I press the default return button, it is not.

I can change the theme from activity preferences. If I return using the ActionBar back button, the colors instantly change, but by default I need to restart the application ....

How can I make my default return button behave like an ActionBar?

+5
source share
4 answers

The back button of an ActionBar is actually a Up button, and it should go to a higher level in the application’s navigation hierarchy. The back button will take you to the last place you looked at.

Another great tip is to better understand that the Up button should always take you to a place in your application, and the Back button can lead you to another application.

You can read this article to better understand the difference: http://developer.android.com/design/patterns/navigation.html

+4
source

The android-back button moves back. The navigation bar button moves up. Navigating up always leads you to the same application you were on, just differently. Back may change the action of the application and.

+1
source

For example:

Go to the Gmail application, start responding to the letter by entering a message, do not send. just now:

  • If the back button is pressed → only the keyboard will be closed.
  • if the "Up" button → → is pressed, both the keyboard and the response activity will be closed.

► The "Back" button works with a stack of back ..... and is not associated with a specific application.
► The "Up" button works with the application hierarchy .. and associated with a specific application.

0
source

In action B:

 @Override public void onBackPressed() { NavUtils.navigateUpFromSameTask(this); super.onBackPressed(); } 

Parent activity must be specified in the manifest file. See also https://developer.android.com/training/implementing-navigation/ancestral.html

0
source

Source: https://habr.com/ru/post/1208299/


All Articles