18739b58f7860d8d03916b9a529d1fd5950937626Adam Powell/* 28739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * Copyright (C) 2012 The Android Open Source Project 38739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * 48739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 58739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * you may not use this file except in compliance with the License. 68739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * You may obtain a copy of the License at 78739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * 88739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 98739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * 108739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * Unless required by applicable law or agreed to in writing, software 118739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 128739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * See the License for the specific language governing permissions and 148739b58f7860d8d03916b9a529d1fd5950937626Adam Powell * limitations under the License. 158739b58f7860d8d03916b9a529d1fd5950937626Adam Powell */ 168739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 178739b58f7860d8d03916b9a529d1fd5950937626Adam Powellpackage com.example.android.support.appnavigation.app; 188739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 198739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport com.example.android.support.appnavigation.R; 208739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 218739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.app.Activity; 228739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.content.Intent; 238739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.os.Bundle; 248739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.support.v4.app.NavUtils; 258739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.view.MenuItem; 268739b58f7860d8d03916b9a529d1fd5950937626Adam Powellimport android.view.View; 278739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 288739b58f7860d8d03916b9a529d1fd5950937626Adam Powellpublic class ViewFromOtherTaskActivity extends Activity { 298739b58f7860d8d03916b9a529d1fd5950937626Adam Powell @Override 308739b58f7860d8d03916b9a529d1fd5950937626Adam Powell protected void onCreate(Bundle savedInstanceState) { 318739b58f7860d8d03916b9a529d1fd5950937626Adam Powell super.onCreate(savedInstanceState); 328739b58f7860d8d03916b9a529d1fd5950937626Adam Powell setContentView(R.layout.view_from_other_task); 338739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 348739b58f7860d8d03916b9a529d1fd5950937626Adam Powell ActionBarCompat.setDisplayHomeAsUpEnabled(this, true); 358739b58f7860d8d03916b9a529d1fd5950937626Adam Powell } 368739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 378739b58f7860d8d03916b9a529d1fd5950937626Adam Powell @Override 388739b58f7860d8d03916b9a529d1fd5950937626Adam Powell public boolean onOptionsItemSelected(MenuItem item) { 398739b58f7860d8d03916b9a529d1fd5950937626Adam Powell if (item.getItemId() == android.R.id.home) { 408739b58f7860d8d03916b9a529d1fd5950937626Adam Powell NavUtils.navigateUpFromSameTask(this); 418739b58f7860d8d03916b9a529d1fd5950937626Adam Powell return true; 428739b58f7860d8d03916b9a529d1fd5950937626Adam Powell } 438739b58f7860d8d03916b9a529d1fd5950937626Adam Powell return false; 448739b58f7860d8d03916b9a529d1fd5950937626Adam Powell } 458739b58f7860d8d03916b9a529d1fd5950937626Adam Powell 468739b58f7860d8d03916b9a529d1fd5950937626Adam Powell public void onLaunchOtherTask(View v) { 478739b58f7860d8d03916b9a529d1fd5950937626Adam Powell Intent target = new Intent(this, OutsideTaskActivity.class) 488739b58f7860d8d03916b9a529d1fd5950937626Adam Powell .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | 498739b58f7860d8d03916b9a529d1fd5950937626Adam Powell Intent.FLAG_ACTIVITY_TASK_ON_HOME); 508739b58f7860d8d03916b9a529d1fd5950937626Adam Powell startActivity(target); 518739b58f7860d8d03916b9a529d1fd5950937626Adam Powell } 528739b58f7860d8d03916b9a529d1fd5950937626Adam Powell} 53