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.granita.tasks.TaskListActivity.java

private void resolveIntentAction(Intent intent) {
    // check which task should be selected
    if (intent.hasExtra(EXTRA_DISPLAY_TASK))

    {//from ww w .  j a  v  a 2  s  .com
        mShouldSwitchToDetail = true;
        mSelectedTaskUri = intent.getData();
    }

    if (intent != null && intent.hasExtra(EXTRA_DISPLAY_TASK)
            && intent.getBooleanExtra(EXTRA_FORCE_LIST_SELECTION, true) && mTwoPane) {
        mShouldSwitchToDetail = true;
        Uri newSelection = intent.getData();
        mSelectedTaskUriOnLaunch = newSelection;
        mShouldSelectTaskListItem = true;
        mPagerAdapter.notifyDataSetChanged();
    } else {
        mSelectedTaskUriOnLaunch = null;
        mShouldSelectTaskListItem = false;
    }
}

From source file:com.androidaq.AndroiDAQTCPMain.java

@Override
public synchronized void onResume() {
    super.onResume();
    if (D)/*from  w ww . j av  a 2  s  . c  om*/
        Log.e(TAG, "+ ON RESUME +");
    Intent intent = getIntent();
    intent.getBooleanExtra("firstopen", firstopen);
    updateFromPreferences();
    /* if (mSerialService != null) {
    // Only if the state is STATE_NONE, do we know that we haven't started already
    Log.d(TAG, "mSerialService.getState() = " + mSerialService.getState());
        if (mSerialService.getState() == AndroidSocket.STATE_NONE) {
      // Start the Bluetooth chat services
      mSerialService.start();
    }
     } */
}

From source file:com.google.sample.castcompanionlibrary.notification.VideoCastNotificationService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    LOGD(TAG, "onStartCommand");
    if (null != intent) {

        String action = intent.getAction();
        if (ACTION_TOGGLE_PLAYBACK.equals(action) && mIsIcsOrAbove) {
            LOGD(TAG, "onStartCommand(): Action: ACTION_TOGGLE_PLAYBACK");
            togglePlayback();/*from   w  w  w. jav a  2  s  . c o m*/
        } else if (ACTION_STOP.equals(action) && mIsIcsOrAbove) {
            LOGD(TAG, "onStartCommand(): Action: ACTION_STOP");
            stopApplication();
        } else if (ACTION_VISIBILITY.equals(action)) {
            mVisible = intent.getBooleanExtra(NOTIFICATION_VISIBILITY, false);
            LOGD(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible);
            if (mVisible) {
                if (mNotification != null) {
                    startForeground(NOTIFICATION_ID, mNotification);
                } else {
                    try {
                        setupNotification(mCastManager.getRemoteMediaInformation());
                    } catch (TransientNetworkDisconnectionException e) {
                        LOGE(TAG, "onStartCommand() failed to get media", e);
                    } catch (NoConnectionException e) {
                        LOGE(TAG, "onStartCommand() failed to get media", e);
                    }
                }
            } else {
                stopForeground(true);
            }
        } else {
            LOGD(TAG, "onStartCommand(): Action: none");
        }

    } else {
        LOGD(TAG, "onStartCommand(): Intent was null");
    }

    return Service.START_STICKY;
}

From source file:com.mb.android.playbackmediator.notification.VideoCastNotificationService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    LOGD(TAG, "onStartCommand");
    if (null != intent) {

        String action = intent.getAction();
        if (ACTION_TOGGLE_PLAYBACK.equals(action) && mIsIcsOrAbove) {
            LOGD(TAG, "onStartCommand(): Action: ACTION_TOGGLE_PLAYBACK");
            togglePlayback();//from ww  w .  ja  v a 2s .  com
        } else if (ACTION_STOP.equals(action) && mIsIcsOrAbove) {
            LOGD(TAG, "onStartCommand(): Action: ACTION_STOP");
            stopApplication();
        } else if (ACTION_VISIBILITY.equals(action)) {
            mVisible = intent.getBooleanExtra(NOTIFICATION_VISIBILITY, false);
            LOGD(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible);
            if (mVisible && null != mNotification) {
                startForeground(NOTIFICATION_ID, mNotification);
                mCastManager.setContext(this);
            } else {
                stopForeground(true);
            }
        } else {
            LOGD(TAG, "onStartCommand(): Action: none");
        }

    } else {
        LOGD(TAG, "onStartCommand(): Intent was null");
    }

    return Service.START_STICKY;
}

From source file:com.frostwire.android.gui.activities.MainActivity.java

private boolean isGoHome(Intent intent) {
    if (intent == null) {
        intent = getIntent();/*w w  w  . j  a  v a 2  s.  co  m*/
    }
    return intent != null && intent.getBooleanExtra("gohome-frostwire", false);
}

From source file:com.androidquery.simplefeed.fragments.FeedFragment.java

@Override
protected void init() {

    Intent intent = act.getIntent();
    if (intent != null) {
        logout = intent.getBooleanExtra("logout", false);
        source = (Entity) intent.getSerializableExtra("source");
    }//from w w w.  j a v  a  2s  . c  o  m

    if (source == null) {
        source = AppUtility.getDefaultSource();
    }

    initView();

    if (logout) {
        showLogin(true);
    } else {
        initAjax(0);
    }

}

From source file:com.landenlabs.all_devtool.GpsFragment.java

private void updateGps(Intent paramIntent) {
    String str = paramIntent.getAction();
    boolean isEnabled = paramIntent.getBooleanExtra("enabled", false);
    if ((str.equals("android.location.GPS_FIX_CHANGE"))) {
        m_isGpsFixed = isEnabled;/*from  w w  w . j av a2  s.  co  m*/
        addMsgToDetailRow(s_colorGps, "Gps " + (m_isGpsFixed ? "fixed" : "unfixed"));
    } else if ((str.equals("android.location.GPS_ENABLED_CHANGE"))) {
        m_isGpsEnabled = isEnabled;
        addMsgToDetailRow(s_colorGps, "Gps " + (m_isGpsEnabled ? "enabled" : "disabled"));
    }
    showProviders();
}

From source file:com.bluros.updater.UpdatesSettings.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    // Check if we need to refresh the screen to show new updates
    if (intent.getBooleanExtra(EXTRA_UPDATE_LIST_UPDATED, false)) {
        requestUpdateLayout();//from ww w  .  j  a  v a 2s  .com
    }

    checkForDownloadCompleted(intent);
}

From source file:com.frostwire.android.gui.activities.MainActivity.java

private boolean isShutdown(Intent intent) {
    if (intent == null) {
        intent = getIntent();/* w  w  w  .  ja va 2  s  .c om*/
    }
    boolean result = intent != null && intent.getBooleanExtra("shutdown-frostwire", false);
    if (result) {
        shutdown();
    }
    return result;
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionDetailFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String chosenAccountName = AccountUtils.getChosenAccountName(getActivity());
    mPlusClient = new PlusClient.Builder(getActivity(), this, this).clearScopes()
            .setAccountName(chosenAccountName).build();

    final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
    mSessionUri = intent.getData();// www.  java  2 s.  c  om

    if (mSessionUri == null) {
        return;
    }

    mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);

    mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);

    LoaderManager manager = getLoaderManager();
    manager.restartLoader(SessionsQuery._TOKEN, null, this);
    manager.restartLoader(SpeakersQuery._TOKEN, null, this);

    setHasOptionsMenu(true);
}