Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onSupportNavigateUp() not called

Tags:

I'm developing an app with ActionBars which supports Gingerbread and up. So basically I'm using the support library and extending

ActionBarActivity

for all my activities. Everything works well except for the

onSupportNavigateUp()

method. It just does not get called as stated in the documentation.

This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.

This is quite easy but I haven't been able to figure out why it does not work as expected nor Googling helped. Is this a bug? or am I missing something?

like image 923
JanithaR Avatar asked Sep 13 '13 06:09

JanithaR


1 Answers

if you override onOptionsItemSelected, then onSupportNavigateUp will not be called.

@Override public boolean onOptionsItemSelected(MenuItem item) {         switch (item.getItemId()) {             case android.R.id.home:                 // handle ⬅️ button here                  break;         }         return true; } 
like image 84
laoyur Avatar answered Oct 01 '22 04:10

laoyur