Example usage for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.

Prototype

int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.

Click Source Link

Usage

From source file:org.petero.droidfish.DroidFish.java

private final void shareGame() {
    Intent i = new Intent(Intent.ACTION_SEND);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.setType("text/plain");
    i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
    try {//ww  w.j  av  a 2s.c  o  m
        startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
    } catch (ActivityNotFoundException ex) {
        // Ignore
    }
}

From source file:edu.mit.viral.shen.DroidFish.java

private final void shareGame() {
    Intent i = new Intent(Intent.ACTION_SEND);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.setType("text/plain");
    i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
    startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
}

From source file:com.if3games.chessonline.DroidFish.java

private final void shareGame() {
    Intent i = new Intent(Intent.ACTION_SEND);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.setType("text/plain");
    //i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
    i.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_name) + " " + ConstantsData.MARKET_URL_HTTP);
    startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_ADD_SUBJECT:
        showSubjectEditor(true);//ww  w  . j a  va2  s.co  m
        mWorkingMessage.setSubject("", true);
        updateSendButtonState();
        mSubjectTextEditor.requestFocus();
        break;
    case MENU_ADD_ATTACHMENT:
        // Launch the add-attachment list dialog
        showAddAttachmentDialog(false);
        break;
    case MENU_DISCARD:
        mWorkingMessage.discard();
        finish();
        break;
    case MENU_SEND:
        if (isPreparedForSending()) {
            confirmSendMessageIfNeeded();
        }
        break;
    case MENU_SEARCH:
        onSearchRequested();
        break;
    case MENU_DELETE_THREAD:
        confirmDeleteThread(mConversation.getThreadId());
        break;

    case android.R.id.home:
    case MENU_CONVERSATION_LIST:
        exitComposeMessageActivity(new Runnable() {
            @Override
            public void run() {
                goToConversationList();
            }
        });
        break;
    case MENU_CALL_RECIPIENT:
        dialRecipient();
        break;
    case MENU_INSERT_SMILEY:
        showSmileyDialog();
        break;
    case MENU_GROUP_PARTICIPANTS: {
        Intent intent = new Intent(this, RecipientListActivity.class);
        intent.putExtra(THREAD_ID, mConversation.getThreadId());
        startActivity(intent);
        break;
    }
    case MENU_VIEW_CONTACT: {
        // View the contact for the first (and only) recipient.
        ContactList list = getRecipients();
        if (list.size() == 1 && list.get(0).existsInDatabase()) {
            Uri contactUri = list.get(0).getUri();
            Intent intent = new Intent(Intent.ACTION_VIEW, contactUri);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            startActivity(intent);
        }
        break;
    }
    case MENU_ADD_ADDRESS_TO_CONTACTS:
        mAddContactIntent = item.getIntent();
        startActivityForResult(mAddContactIntent, REQUEST_CODE_ADD_CONTACT);
        break;
    case MENU_CONVERSATION_OPTIONS: {
        Intent intent = new Intent(this, ConversationOptionsActivity.class);
        intent.putExtra(THREAD_ID, mConversation.getThreadId());
        startActivityIfNeeded(intent, -1);
        break;
    }
    case MENU_PREFERENCES: {
        Intent intent = new Intent(this, MessagingPreferenceActivity.class);
        startActivityIfNeeded(intent, -1);
        break;
    }
    case MENU_DEBUG_DUMP:
        mWorkingMessage.dump();
        Conversation.dump();
        LogTag.dumpInternalTables(this);
        break;
    case MENU_ADD_TEMPLATE:
        startLoadingTemplates();
        break;
    case MENU_ADD_TO_BLACKLIST:
        confirmAddBlacklist();
        break;
    }

    return true;
}

From source file:com.android.mail.compose.ComposeActivity.java

@SuppressLint("NewApi")
private void doAttach(String type) {
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    i.setType(type);/*  ww w.  jav a  2  s  .  c  om*/
    mAddingAttachment = true;
    startActivityForResult(Intent.createChooser(i, getText(R.string.select_attachment_type)),
            RESULT_PICK_ATTACHMENT);
}

From source file:com.tct.mail.compose.ComposeActivity.java

@SuppressLint("NewApi")
private void doAttach(String type) {
    mAddingAttachment = true;//TS: yang.mei 2015-1-19 EMAIL BUGFIX_1441004 MOD
    //TS: zheng.zou 2015-11-30 EMAIL TASK_869664 ADD_S
    if (PermissionUtil.checkAndRequestPermissionForResult(this, Manifest.permission.READ_EXTERNAL_STORAGE,
            PermissionUtil.REQ_CODE_PERMISSION_ADD_ATTACHMENT)) { //TS: jin.dong 2015-12-17 EMAIL BUGFIX_1170083 MOD
        Intent i = new Intent(Intent.ACTION_GET_CONTENT);
        i.addCategory(Intent.CATEGORY_OPENABLE);
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        i.setType(type);/* w ww  .ja  v a2 s  . c  o  m*/
        startActivityForResult(Intent.createChooser(i, getText(R.string.select_attachment_type)),
                RESULT_PICK_ATTACHMENT);

    }
    //TS: zheng.zou 2015-11-30 EMAIL TASK_869664 ADD_E
}