Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

In this page you can find the example usage for android.os Bundle getBoolean.

Prototype

public boolean getBoolean(String key) 

Source Link

Document

Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

Usage

From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java

@Override
public void onActivityCreated(Bundle bundle) {
    if (null != bundle) {
        //Log.e("Saving","Found a bundle!!!!");

        if (bundle.containsKey("eventStateAcknowledged") && bundle.getBoolean("eventStateAcknowledged")) {
            ackIcon.setImageResource(R.drawable.ic_acknowledged);
            isAcknowledged = true;/*from www.j a  v  a 2 s  .  co  m*/
        }

        if (bundle.containsKey("Title"))
            Title.setText(bundle.getString("Title"));

        if (bundle.containsKey("Component"))
            Component.setText(bundle.getString("Component"));

        if (bundle.containsKey("EventClass"))
            EventClass.setText(bundle.getString("EventClass"));

        if (bundle.containsKey("Summary"))
            Summary.setText(Html.fromHtml(bundle.getString("Summary"), null, null));

        if (bundle.containsKey("FirstTime"))
            FirstTime.setText(bundle.getString("FirstTime"));

        if (bundle.containsKey("LastTime"))
            LastTime.setText(bundle.getString("LastTime"));

        if (bundle.containsKey("EventCount"))
            EventCount.setText(bundle.getString("EventCount"));

        if (bundle.containsKey("agent"))
            agent.setText(bundle.getString("agent"));

        if (bundle.containsKey("LogEntries")) {
            try {
                String[] LogEntries = bundle.getStringArray("LogEntries");
                int LogEntryCount = LogEntries.length;

                for (int i = 0; i < LogEntryCount; i++) {
                    TextView newLog = new TextView(getActivity());
                    newLog.setText(Html.fromHtml(LogEntries[i]));
                    newLog.setPadding(0, 6, 0, 6);
                    logList.addView(newLog);
                }
            } catch (Exception e) {
                e.printStackTrace();
                BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "oncreate bundle", e);
            }
        }

        if (bundle.containsKey("img")) {
            try {
                img.setImageBitmap((Bitmap) bundle.getParcelable("img"));
                img.invalidate();
            } catch (Exception e) {
                e.printStackTrace();
                BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "oncreate bundle image", e);
            }
        }

        progressbar.setVisibility(View.INVISIBLE);
    } else {
        //Log.e("Saving","Didn't find any data so getting it");
        preLoadData();
    }

    super.onActivityCreated(bundle);
}

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

public void initialize(Bundle savedState, ContactsRequest request) {
    if (savedState == null) {
        mSearchMode = request.isSearchMode();
        mQueryString = request.getQueryString();
        mCurrentTab = loadLastTabPreference();
        mSelectionMode = false;//from  w ww . j a  va 2s.c  o m
    } else {
        mSearchMode = savedState.getBoolean(EXTRA_KEY_SEARCH_MODE);
        mSelectionMode = savedState.getBoolean(EXTRA_KEY_SELECTED_MODE);
        mQueryString = savedState.getString(EXTRA_KEY_QUERY);

        // Just set to the field here.  The listener will be notified by update().
        mCurrentTab = savedState.getInt(EXTRA_KEY_SELECTED_TAB);
    }
    if (mCurrentTab >= TabState.COUNT || mCurrentTab < 0) {
        // Invalid tab index was saved (b/12938207). Restore the default.
        mCurrentTab = TabState.DEFAULT;
    }
    // Show tabs or the expanded {@link SearchView}, depending on whether or not we are in
    // search mode.
    update(true /* skipAnimation */);
    // Expanding the {@link SearchView} clears the query, so set the query from the
    // {@link ContactsRequest} after it has been expanded, if applicable.
    if (mSearchMode && !TextUtils.isEmpty(mQueryString)) {
        setQueryString(mQueryString);
    }
}

From source file:android.support.v7.widget.SuggestionsAdapter.java

private void updateSpinnerState(Cursor cursor) {
    Bundle extras = cursor != null ? cursor.getExtras() : null;
    if (DBG) {/*  w  w  w.ja  va2  s .c o m*/
        Log.d(LOG_TAG, "updateSpinnerState - extra = "
                + (extras != null ? extras.getBoolean(SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS) : null));
    }
    // Check if the Cursor indicates that the query is not complete and show the spinner
    if (extras != null && extras.getBoolean(SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS)) {
        return;
    }
    // If cursor is null or is done, stop the spinner
}

From source file:br.liveo.searchliveo.SearchCardLiveo.java

@Override
public void onRestoreInstanceState(Parcelable state) {

    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        this.setActive(bundle.getBoolean(STATE_TO_SAVE));

        String text = bundle.getString(SEARCH_TEXT, "");
        if (!text.trim().equals("")) {
            mEdtSearch.setText(text);/*  w ww .j av a2s  .c  o m*/
        }

        if (this.isActive()) {
            show();
        }

        state = bundle.getParcelable(INSTANCE_STATE);
    }

    super.onRestoreInstanceState(state);
}

From source file:com.antew.redditinpictures.library.ui.ImageViewerActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_ENTRIES)) {
        mImages = savedInstanceState.getParcelableArrayList(Constants.Extra.EXTRA_ENTRIES);
    }// w  w  w. j  a va 2s.c om

    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_IS_SWIPING_ENABLED)) {
        mSwipingEnabled = savedInstanceState.getBoolean(Constants.Extra.EXTRA_IS_SWIPING_ENABLED);
    }

    if (savedInstanceState.containsKey(Constants.Extra.EXTRA_IMAGE)) {
        mRequestedPage = savedInstanceState.getInt(Constants.Extra.EXTRA_IMAGE);
    }
}

From source file:com.dvn.vindecoder.ui.seller.AddVehicalAndPayment.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setContentView( R.layout.activity_add_vehical_and_payment);
    drawChildLayout();//from  ww w  .j a  v a 2  s.  c  o m
    setTitle("Add Vehical");
    Bundle bundle = getIntent().getExtras();

    //  addNewVehicalFragment=new AddNewVehicalFragment(this);

    boolean scanFlag = false;
    if (bundle != null) {
        scanFlag = bundle.getBoolean("boolean");
    }
    if (savedInstanceState == null) {
        // Do first time initialization -- add initial fragment.
        addNewVehicalFragment = AddNewVehicalFragment.newInstance(this, scanFlag);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.fragment1, addNewVehicalFragment).commit();
    } else {
        mStackLevel = savedInstanceState.getInt("level");
    }
    collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    /*   toolbar = (Toolbar) findViewById(R.id.toolbar);
         setSupportActionBar(toolbar);*/

}

From source file:com.android.calendar.EventInfoActivity.java

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

    // Get the info needed for the fragment
    Intent intent = getIntent();/*w w  w .j  a  v  a 2  s. c  o  m*/
    int attendeeResponse = 0;
    mEventId = -1;
    boolean isDialog = false;
    ArrayList<ReminderEntry> reminders = null;

    if (icicle != null) {
        mEventId = icicle.getLong(EventInfoFragment.BUNDLE_KEY_EVENT_ID);
        mStartMillis = icicle.getLong(EventInfoFragment.BUNDLE_KEY_START_MILLIS);
        mEndMillis = icicle.getLong(EventInfoFragment.BUNDLE_KEY_END_MILLIS);
        attendeeResponse = icicle.getInt(EventInfoFragment.BUNDLE_KEY_ATTENDEE_RESPONSE);
        isDialog = icicle.getBoolean(EventInfoFragment.BUNDLE_KEY_IS_DIALOG);

        reminders = Utils.readRemindersFromBundle(icicle);
    } else if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
        mStartMillis = intent.getLongExtra(EXTRA_EVENT_BEGIN_TIME, 0);
        mEndMillis = intent.getLongExtra(EXTRA_EVENT_END_TIME, 0);
        attendeeResponse = intent.getIntExtra("attendeeStatus", Attendees.ATTENDEE_STATUS_NONE);
        Uri data = intent.getData();
        if (data != null) {
            try {
                List<String> pathSegments = data.getPathSegments();
                int size = pathSegments.size();
                if (size > 2 && "EventTime".equals(pathSegments.get(2))) {
                    // Support non-standard VIEW intent format:
                    // dat =
                    // content://com.android.calendar/events/[id]/EventTime/[start]/[end]
                    mEventId = Long.parseLong(pathSegments.get(1));
                    if (size > 4) {
                        mStartMillis = Long.parseLong(pathSegments.get(3));
                        mEndMillis = Long.parseLong(pathSegments.get(4));
                    }
                } else {
                    mEventId = Long.parseLong(data.getLastPathSegment());
                }
            } catch (NumberFormatException e) {
                if (mEventId == -1) {
                    // do nothing here , deal with it later
                } else if (mStartMillis == 0 || mEndMillis == 0) {
                    // Parsing failed on the start or end time , make sure
                    // the times were not
                    // pulled from the intent's extras and reset them.
                    mStartMillis = 0;
                    mEndMillis = 0;
                }
            }
        }
    }

    if (mEventId == -1) {
        Log.w(TAG, "No event id");
        Toast.makeText(this, R.string.event_not_found, Toast.LENGTH_SHORT).show();
        finish();
    }

    // If we do not support showing full screen event info in this
    // configuration,
    // close the activity and show the event in AllInOne.
    Resources res = getResources();
    if (!res.getBoolean(R.bool.agenda_show_event_info_full_screen)
            && !res.getBoolean(R.bool.show_event_info_full_screen)) {
        CalendarController.getInstance(this).launchViewEvent(mEventId, mStartMillis, mEndMillis,
                attendeeResponse);
        finish();
        return;
    }

    setContentView(R.layout.simple_frame_layout);

    // Get the fragment if exists
    mInfoFragment = (EventInfoFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);

    // Remove the application title
    ActionBar bar = getActionBar();
    if (bar != null) {
        bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP);
    }

    // Create a new fragment if none exists
    if (mInfoFragment == null) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction ft = fragmentManager.beginTransaction();
        mInfoFragment = new EventInfoFragment(this, mEventId, mStartMillis, mEndMillis, attendeeResponse,
                isDialog,
                (isDialog ? EventInfoFragment.DIALOG_WINDOW_STYLE : EventInfoFragment.FULL_WINDOW_STYLE),
                reminders);
        ft.replace(R.id.main_frame, mInfoFragment);
        ft.commit();
    }
}

From source file:be.evias.cloudLogin.cloudLoginRunPointActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_runpoint);

    mAccountManager = AccountManager.get(this);
    mContext = getBaseContext();/* w  w w. j a v  a 2  s .  c  o m*/
    mPrefs = mContext.getSharedPreferences("cloudlogin", Context.MODE_PRIVATE);

    findViewById(R.id.create_select_account).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            displayAccountPicker(AUTHTOKEN_TYPE_FULL_ACCESS);
        }
    });

    displayAccountPicker(AUTHTOKEN_TYPE_FULL_ACCESS);

    if (savedInstanceState != null) {
        boolean showDialog = savedInstanceState.getBoolean(STATE_DIALOG);
        if (showDialog)
            displayAccountPicker(AUTHTOKEN_TYPE_FULL_ACCESS);
    }
}

From source file:com.hackensack.umc.activity.ProfileActivity.java

private void setValuesFromSavedInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        if (!savedInstanceState.getBoolean(Constant.PROFILE_DIALOG)) {
            showAlert(ProfileActivity.this, getString(R.string.msg_easy_data), "Easy Data Entry");
        }/* ww w . j a va2s  .  c om*/
        String imgUrlFront = savedInstanceState.getString(Constant.KEY_ID_FRONT);
        if (imgUrlFront != null) {
            setPhotoToImageView(imgUrlFront, imgIdFront);
        }
        String imgUrlBack = savedInstanceState.getString(Constant.KEY_ID_BACK);
        if (imgUrlBack != null) {
            setPhotoToImageView(imgUrlBack, imgIdBack);
        }
        String imgUrlIcFront = savedInstanceState.getString(Constant.KEY_INSURANCE_FRONT);
        if (imgUrlIcFront != null) {
            setPhotoToImageView(imgUrlIcFront, imgIcFront);
        }
        String imgUrlIcBack = savedInstanceState.getString(Constant.KEY_INSURANCE_BACK);
        if (imgUrlIcBack != null) {
            setPhotoToImageView(imgUrlIcBack, imgIcBack);
        }
        String imgUrlSelfie = savedInstanceState.getString(Constant.KEY_INSURANCE_BACK);
        if (imgUrlSelfie != null) {
            setPhotoToImageView(imgUrlSelfie, imgSelfie);
        }
    }
}

From source file:pt.up.mobile.syncadapter.SigarraSyncAdapter.java

@TargetApi(8)
@Override/*w  ww  . j  av  a2 s  .co  m*/
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
        SyncResult syncResult) {
    boolean listeningToProblems = false;
    try {
        if (extras.getBoolean(SINGLE_REQUEST)) {
            listeningToProblems = true;
            Log.d(getClass().getSimpleName(), "Fetching Sigarra");
            if (SUBJECT.equals(extras.getString(REQUEST_TYPE))) {
                getSubject(account, extras.getString(CODE), syncResult);
                return;
            }
            if (PROFILE.equals(extras.getSerializable(REQUEST_TYPE))) {
                getProfile(account, extras.getString(PROFILE_CODE), extras.getString(PROFILE_TYPE), syncResult);
                return;
            }

            if (EXAMS.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncExams(account, syncResult);
                return;
            }
            if (ACADEMIC_PATH.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncAcademicPath(account, syncResult);
                return;
            }
            if (PROFILE_PIC.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncProfilePic(extras.getString(CODE), account, syncResult);
                return;
            }
            if (TUITION.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncTuition(account, syncResult);
                return;
            }
            if (TEACHING_SERVICE.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncTeachingService(account, syncResult);
                return;
            }
            if (PRINTING_QUOTA.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncPrintingQuota(account, syncResult);
                return;
            }
            if (NOTIFICATIONS.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncNotifications(account, syncResult);
                return;
            }
            if (CANTEENS.equals(extras.getSerializable(REQUEST_TYPE))) {
                syncCanteens(account, syncResult);
                return;
            }
            if (SCHEDULE.equals(extras.getSerializable(REQUEST_TYPE))) {
                getSchedule(account, extras.getString(SCHEDULE_CODE), extras.getString(SCHEDULE_TYPE),
                        extras.getString(SCHEDULE_INITIAL), extras.getString(SCHEDULE_FINAL), SyncStates.PRUNE,
                        syncResult);
                return;
            }
        } else {
            Log.d(getClass().getSimpleName(), "Sync Sigarra");
            syncProfiles(account, syncResult);
            syncExams(account, syncResult);
            syncTuition(account, syncResult);
            syncPrintingQuota(account, syncResult);
            syncSchedule(account, syncResult);
            syncNotifications(account, syncResult);
            syncCanteens(account, syncResult);
            final User user = AccountUtils.getUser(getContext(), account.name);
            if (user.getType().equals(SifeupAPI.STUDENT_TYPE)) {
                syncAcademicPath(account, syncResult);
                syncSubjects(account, syncResult);
            } else {
                syncTeachingService(account, syncResult);
            }
        }
    } catch (IOException e) {
        syncResult.stats.numIoExceptions++;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO)
            syncResult.delayUntil = 3600;
        if (listeningToProblems)
            broadcastManager.sendBroadcast(
                    new Intent(SIGARRASYNCADAPTER_STATUS).putExtra(SIGARRASYNCADAPTER_STATUS, NETWORK_ERROR));
        e.printStackTrace();
    } catch (AuthenticationException e) {
        e.printStackTrace();
        mAccountManager.invalidateAuthToken(Constants.ACCOUNT_TYPE, null);
        syncResult.stats.numAuthExceptions++;
        if (listeningToProblems)
            broadcastManager.sendBroadcast(new Intent(SIGARRASYNCADAPTER_STATUS)
                    .putExtra(SIGARRASYNCADAPTER_STATUS, AUTHENTICATION_ERROR));
    } catch (Exception e) {
        if (listeningToProblems)
            broadcastManager.sendBroadcast(
                    new Intent(SIGARRASYNCADAPTER_STATUS).putExtra(SIGARRASYNCADAPTER_STATUS, GENERAL_ERROR));
        e.printStackTrace();
        LogUtils.trackException(getContext(), e, null, true);
    }
}