Skip to content

Most visited

Recently visited

navigation
DocumentCentricRelinquishIdentity / src / com.example.android.documentcentricrelinquishidentity /

RelinquishIdentityActivity.java

1
/*
2
 * Copyright (C) 2014 The Android Open Source Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
package com.example.android.documentcentricrelinquishidentity;
18
 
19
import android.app.Activity;
20
import android.content.Intent;
21
import android.os.Bundle;
22
import android.view.View;
23
 
24
/**
25
 * Activities that serve as the root of a task may give up certain task identifiers to activities
26
 * above it in the task stack. These identifiers include the task base Intent, and the task name,
27
 * color and icon used in the recent task list. The base @link{Intent} is used to match the task when
28
 * relaunching based on an incoming Intent.
29
 *
30
 * <p>
31
 * To relinquish its identity the base activity must have the activity attribute
32
 * android:relinquishTaskIdentity=”true” in the manifest.
33
 * </p>
34
 */
35
public class RelinquishIdentityActivity extends Activity {
36
 
37
    @Override
38
    protected void onCreate(Bundle savedInstanceState) {
39
        super.onCreate(savedInstanceState);
40
        setContentView(R.layout.activity_relinquish_identity);
41
    }
42
 
43
    public void createNewDocument(View view) {
44
        final Intent intent = newDocumentIntent();
45
        startActivity(intent);
46
    }
47
 
48
    /**
49
     * Returns an new intent to start {@link NewDocumentActivity}
50
     * as a new document in recents..
51
     */
52
    private Intent newDocumentIntent() {
53
        final Intent newDocumentIntent = new Intent(this, NewDocumentActivity.class);
54
        newDocumentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
55
        // Always launch in a new task.
56
        newDocumentIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
57
        return newDocumentIntent;
58
    }
59
 
60
}
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.