Example usage for android.content Intent getBooleanExtra

List of usage examples for android.content Intent getBooleanExtra

Introduction

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

Prototype

public boolean getBooleanExtra(String name, boolean defaultValue) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.mobicage.rogerthat.NewsActivity.java

private void processFriendInfoReceived(Intent intent) {
    if (expectedEmailHash != null
            && expectedEmailHash.equals(intent.getStringExtra(ProcessScanActivity.EMAILHASH))) {
        mProgressDialog.dismiss();//  w w  w . j  a va2s . c om

        if (intent.getBooleanExtra(ProcessScanActivity.SUCCESS, true)) {
            Intent launchIntent = new Intent(NewsActivity.this, ServiceDetailActivity.class);
            if (existence == Friend.DELETED || existence == Friend.DELETION_PENDING) {
                launchIntent.putExtra(ServiceDetailActivity.EXISTENCE, Friend.NOT_FOUND);
            } else {
                launchIntent.putExtra(ServiceDetailActivity.EXISTENCE, existence);
            }

            GetUserInfoResponseTO item = new GetUserInfoResponseTO();
            item.avatar = intent.getStringExtra(ProcessScanActivity.AVATAR);
            item.avatar_id = -1;
            item.description = intent.getStringExtra(ProcessScanActivity.DESCRIPTION);
            item.descriptionBranding = intent.getStringExtra(ProcessScanActivity.DESCRIPTION_BRANDING);
            item.email = intent.getStringExtra(ProcessScanActivity.EMAIL);
            item.name = intent.getStringExtra(ProcessScanActivity.NAME);
            item.qualifiedIdentifier = intent.getStringExtra(ProcessScanActivity.QUALIFIED_IDENTIFIER);
            item.type = intent.getLongExtra(ProcessScanActivity.TYPE, FriendsPlugin.FRIEND_TYPE_SERVICE);
            launchIntent.putExtra(ServiceDetailActivity.GET_USER_INFO_RESULT,
                    JSONValue.toJSONString(item.toJSONMap()));
            startActivity(launchIntent);
        } else {
            UIUtils.showErrorDialog(this, intent);
        }
    }
}

From source file:com.radicaldynamic.groupinform.activities.LauncherActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // If SD card error, quit
    if (!FileUtilsExtended.storageReady())
        showDialog(DIALOG_EXTERNAL_STORAGE_UNAVAILABLE);

    Intent intent = getIntent();

    if (intent == null) {
    } else {//from  w  ww . j  a  v  a2 s  .  c o  m
        if (intent.getBooleanExtra(KEY_REINIT_IOSERVICE, false)) {
            if (Collect.getInstance().getIoService() instanceof InformOnlineService)
                Collect.getInstance().getIoService().reinitializeService();
        }
    }

    displaySplash();

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.launcher);

    mProgressLoading = (TextView) findViewById(R.id.progressLoading);

    startService(new Intent(this, InformOnlineService.class));
    startService(new Intent(this, DatabaseService.class));

    new InitializeApplicationTask().execute(getApplicationContext());
}

From source file:com.github.michalbednarski.intentslab.ReceiveBroadcastService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    // Flag us as running
    sIsRunning = true;/*from  www  .  ja  va  2 s .co  m*/

    // Prepare receiver and unregister old one if exist
    if (mReceiver != null) {
        // We were already started, clear old receiver
        unregisterReceiver(mReceiver);
    } else {
        mReceiver = new MyBroadcastReceiver();
    }

    if (intent.getBooleanExtra("multiple", false)) {
        sReceivedBroadcasts = new ArrayList<ReceivedBroadcast>();
    } else {
        sReceivedBroadcasts = null;
    }

    // Get IntentFilter and register receiver
    String action = "";
    Parcelable[] filters = intent.getParcelableArrayExtra("intentFilters");
    if (filters == null || filters.length == 0) {
        stopSelf();
        return START_NOT_STICKY;
    }
    for (Parcelable uncastedFilter : filters) {
        IntentFilter filter = (IntentFilter) uncastedFilter;
        registerReceiver(mReceiver, filter);
        if (filters.length == 1) {
            if (filter.countActions() == 1) {
                action = filter.getAction(0);
            }
        }
    }

    // Show notification
    if (sReceivedBroadcasts != null) {
        showListeningMultipleNotification();
    } else {
        showWaitingNotification(action);
    }
    return START_NOT_STICKY;
}

From source file:edu.mit.mobile.android.locast.accounts.AuthenticatorActivity.java

/**
 * {@inheritDoc}//from w w  w.ja v  a  2s  . c  o  m
 */
@Override
public void onCreate(Bundle icicle) {
    Log.i(TAG, "onCreate(" + icicle + ")");
    super.onCreate(icicle);

    mAccountManager = AccountManager.get(this);
    Log.i(TAG, "loading data from Intent");

    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(EXTRA_USERNAME);
    mAuthtokenType = intent.getStringExtra(EXTRA_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(EXTRA_CONFIRMCREDENTIALS, false);

    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    // make the title based on the app name.
    setTitle(getString(R.string.login_title, getString(R.string.app_name)));

    setContentView(R.layout.login);
    // this is done this way, so the associated icon is managed in XML.
    try {
        getWindow().setFeatureDrawable(Window.FEATURE_LEFT_ICON,
                getPackageManager().getActivityIcon(getComponentName()));
    } catch (final NameNotFoundException e) {
        e.printStackTrace();
    }

    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username);
    mPasswordEdit = (EditText) findViewById(R.id.password);
    mPasswordEdit.setOnEditorActionListener(this);
    findViewById(R.id.login).setOnClickListener(this);
    findViewById(R.id.cancel).setOnClickListener(this);
    ((Button) findViewById(R.id.register)).setOnClickListener(this);

    mUsernameEdit.setText(mUsername);

    mAuthenticationTask = (AuthenticationTask) getLastNonConfigurationInstance();
    if (mAuthenticationTask != null) {
        mAuthenticationTask.attach(this);
    }
}

From source file:cn.moon.superwechat.ui.MainActivity.java

private void showExceptionDialogFromIntent(Intent intent) {
    EMLog.e(TAG, "showExceptionDialogFromIntent");
    if (!isExceptionDialogShow && intent.getBooleanExtra(Constant.ACCOUNT_CONFLICT, false)) {
        showExceptionDialog(Constant.ACCOUNT_CONFLICT);
    } else if (!isExceptionDialogShow && intent.getBooleanExtra(Constant.ACCOUNT_REMOVED, false)) {
        showExceptionDialog(Constant.ACCOUNT_REMOVED);
    } else if (!isExceptionDialogShow && intent.getBooleanExtra(Constant.ACCOUNT_FORBIDDEN, false)) {
        showExceptionDialog(Constant.ACCOUNT_FORBIDDEN);
    }//from   w w w.  ja  v a2 s  .co m
}

From source file:com.android.mail.photo.MailPhotoViewController.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mActionHandler = new AttachmentActionHandler(mMailActivity.getContext(), null);
    mActionHandler.initialize(mMailActivity.getFragmentManager());

    final Intent intent = mMailActivity.getIntent();
    mAccountType = intent.getStringExtra(MailPhotoViewActivity.EXTRA_ACCOUNT_TYPE);
    final String account = intent.getStringExtra(MailPhotoViewActivity.EXTRA_ACCOUNT);
    final Message msg = intent.getParcelableExtra(MailPhotoViewActivity.EXTRA_MESSAGE);
    mHideExtraOptionOne = intent.getBooleanExtra(MailPhotoViewActivity.EXTRA_HIDE_EXTRA_OPTION_ONE, false);
    mActionHandler.setAccount(account);//from  www.j  ava  2  s . c om
    mActionHandler.setMessage(msg);
}

From source file:com.nbos.phonebook.sync.authenticator.AuthenticatorActivity.java

/**
 * {@inheritDoc}//from   w ww .  jav a2 s.c o m
 */
@Override
public void onCreate(Bundle icicle) {
    Log.i(tag, "onCreate(" + icicle + ")");
    super.onCreate(icicle);
    mAccountManager = AccountManager.get(this);
    Log.i(tag, "loading data from Intent");
    final Intent intent = getIntent();
    mUsername = intent.getStringExtra(PARAM_USERNAME);
    mAuthtokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false);

    Log.i(tag, "request new: " + mRequestNewAccount + " ,ConfirmCredentials: " + mConfirmCredentials);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login_activity);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);

    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.country_code_array,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);
    setSpinnerCountry(spinner);
    mMessage = (TextView) findViewById(R.id.message);
    mUsernameEdit = (EditText) findViewById(R.id.username_edit);
    mPasswordEdit = (EditText) findViewById(R.id.password_edit);
    mPhoneEdit = (EditText) findViewById(R.id.phone_edit);
    getPhoneNumber(getApplicationContext());
    mUsernameEdit.setText(mUsername);
    mMessage.setText(getMessage());
}

From source file:com.android.contacts.activities.PhotoSelectionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photoselection_activity);
    if (savedInstanceState != null) {
        mCurrentPhotoUri = savedInstanceState.getParcelable(KEY_CURRENT_PHOTO_URI);
        mSubActivityInProgress = savedInstanceState.getBoolean(KEY_SUB_ACTIVITY_IN_PROGRESS);
    }/*from   ww w .ja v  a  2s  .com*/

    // Pull data out of the intent.
    final Intent intent = getIntent();
    mPhotoUri = intent.getParcelableExtra(PHOTO_URI);
    mState = (RawContactDeltaList) intent.getParcelableExtra(ENTITY_DELTA_LIST);
    mIsProfile = intent.getBooleanExtra(IS_PROFILE, false);
    mIsDirectoryContact = intent.getBooleanExtra(IS_DIRECTORY_CONTACT, false);
    mExpandPhoto = intent.getBooleanExtra(EXPAND_PHOTO, false);

    // Pull out photo expansion properties from resources
    mExpandedPhotoSize = getResources().getDimensionPixelSize(R.dimen.detail_contact_photo_expanded_size);
    mHeightOffset = getResources().getDimensionPixelOffset(R.dimen.expanded_photo_height_offset);

    mBackdrop = findViewById(R.id.backdrop);
    mPhotoView = (ImageView) findViewById(R.id.photo);
    mSourceBounds = intent.getSourceBounds();

    // Fade in the background.
    animateInBackground();

    // Dismiss the dialog on clicking the backdrop.
    mBackdrop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    // Wait until the layout pass to show the photo, so that the source bounds will match up.
    SchedulingUtils.doAfterLayout(mBackdrop, new Runnable() {
        @Override
        public void run() {
            displayPhoto();
        }
    });
}

From source file:com.flowzr.activity.BlotterFragment.java

public void createTransactionFromTemplate(Intent data) {
    long templateId = data.getLongExtra(SelectTemplateActivity.TEMPATE_ID, -1);
    int multiplier = data.getIntExtra(SelectTemplateActivity.MULTIPLIER, 1);
    boolean edit = data.getBooleanExtra(SelectTemplateActivity.EDIT_AFTER_CREATION, false);
    if (templateId > 0) {
        long id = duplicateTransaction(templateId, multiplier);
        Transaction t = db.getTransaction(id);
        if (t.fromAmount == 0 || edit) {
            new BlotterOperations(this, db, id).asNewFromTemplate().editTransaction();
        }//from w w  w  . jav  a2s .  c  o  m
    }
}

From source file:com.binomed.showtime.android.util.activity.AbstractCineShowTimeActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data != null) {
        getModelActivity().setNullResult(data.getBooleanExtra(ParamIntent.ACTIVITY_SEARCH_NULL_RESULT, false));
        getModelActivity().setResetTheme(data.getBooleanExtra(ParamIntent.PREFERENCE_RESULT_THEME, false));
    } else {/*from  w w  w  . ja va  2s . co  m*/
        getModelActivity().setResetTheme(false);
        getModelActivity().setNullResult(false);
    }

    refreshResultsIntent();

    if (requestCode == CineShowtimeCst.ACTIVITY_RESULT_PREFERENCES) {
        doChangeFromPref();
    }

    if (getModelActivity().isResetTheme()) {
        // Analytics part
        String defaultTheme = getResources().getString(R.string.preference_gen_default_theme);
        String theme = getPrefs().getString(getResources().getString(R.string.preference_gen_key_theme),
                defaultTheme);
        if (theme.equals(defaultTheme)) {
            tracker.trackEvent(CineShowtimeCst.ANALYTICS_CATEGORY_ACTIVITY // Category
                    , CineShowtimeCst.ANALYTICS_ACTION_CHANGE_THEME // Action
                    , getTrackerName() + " : " + CineShowtimeCst.ANALYTICS_VALUE_THEME_BLACK // Label
                    , 0 // Value
            );
        } else {
            tracker.trackEvent(CineShowtimeCst.ANALYTICS_CATEGORY_ACTIVITY // Category
                    , CineShowtimeCst.ANALYTICS_ACTION_CHANGE_THEME // Action
                    , getTrackerName() + " : " + CineShowtimeCst.ANALYTICS_VALUE_THEME_LIGHT // Label
                    , 0 // Value
            );
        }

        CineShowTimeLayoutUtils.changeToTheme(this, getIntent());

    }
}