{"action":"opened","issue":{"url":"https://api.github.com/repos/ginatrapani/cinefile/issues/12","labels_url":"https://api.github.com/repos/ginatrapani/cinefile/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/ginatrapani/cinefile/issues/12/comments","events_url":"https://api.github.com/repos/ginatrapani/cinefile/issues/12/events","html_url":"https://github.com/ginatrapani/cinefile/issues/12","id":102660871,"number":12,"title":"In Movie Detail Activity, correctly handle Back button press","user":{"login":"ginatrapani","id":60632,"avatar_url":"https://avatars.githubusercontent.com/u/60632?v=3","gravatar_id":"","url":"https://api.github.com/users/ginatrapani","html_url":"https://github.com/ginatrapani","followers_url":"https://api.github.com/users/ginatrapani/followers","following_url":"https://api.github.com/users/ginatrapani/following{/other_user}","gists_url":"https://api.github.com/users/ginatrapani/gists{/gist_id}","starred_url":"https://api.github.com/users/ginatrapani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ginatrapani/subscriptions","organizations_url":"https://api.github.com/users/ginatrapani/orgs","repos_url":"https://api.github.com/users/ginatrapani/repos","events_url":"https://api.github.com/users/ginatrapani/events{/privacy}","received_events_url":"https://api.github.com/users/ginatrapani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-23T21:00:16Z","updated_at":"2015-08-23T21:00:16Z","closed_at":null,"body":"Right now, when the up/back arrow is pressed on this activity, the App correctly navigates back to the grid of movies but also initiates the network operation to fetch movies once again. This might be undesirable and inefficient.\r\n\r\nYou have to options to emulate a System's back key press:\r\n\r\n1. Using Android's android:launchMode attribute in the AndroidMainfest.xml can open the existing activity instance from the back stack instead of recreating a new activity, which is the default behavior. You can link students to this article titled \"Understand Android Activity's launchMode: standard, singleTop, singleTask and singleInstance\" for more information.\r\n2. In onOptionsItemSelected, handle the click on up/back/home button and call onBackPressed().\r\n        if (id == R.id.action_settings) {\r\n            startActivity(new Intent(this, SettingsActivity.class));\r\n            return true;\r\n        } else {\r\n            onBackPressed();\r\n            finish();\r\n        }"}}