Example usage for android.os Bundle remove

List of usage examples for android.os Bundle remove

Introduction

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

Prototype

public void remove(String key) 

Source Link

Document

Removes any entry with the given key from the mapping of this Bundle.

Usage

From source file:de.vanita5.twittnuker.fragment.support.AbsStatusesFragment.java

@Override
public final Loader<Data> onCreateLoader(int id, Bundle args) {
    final boolean fromUser = args.getBoolean(EXTRA_FROM_USER);
    args.remove(EXTRA_FROM_USER);
    return onCreateStatusesLoader(getActivity(), args, fromUser);
}

From source file:org.worshipsongs.activity.CustomYoutubeBoxActivity.java

private void initSetUp(Bundle bundle) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    if (bundle != null) {
        millis = bundle.getInt(KEY_VIDEO_TIME);
        Log.i(this.getClass().getSimpleName(), "Video time " + millis);
        bundle.remove("android:fragments");
    }/*from   ww w  . ja v  a2  s  .  c  o m*/

    Bundle extras = getIntent().getExtras();
    if (extras != null && extras.containsKey(KEY_VIDEO_ID)) {
        mVideoId = extras.getString(KEY_VIDEO_ID);
    } else {
        finish();
    }
}

From source file:com.trellmor.mocklocationpicture.MLPActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mImageUri != null) {
        outState.putParcelable(KEY_IMAGE_URI, mImageUri);
    } else {//from   ww  w  . j  a v  a  2  s .  co  m
        outState.remove(KEY_IMAGE_URI);
    }
}

From source file:de.ribeiro.android.gso.activities.PlanActivity.java

@SuppressLint("NewApi")
@Override/*from  ww w  .j  av a 2s  .c o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ImageButton FAB;
    // Android Version prfen, wenn neuer als API11,
    Boolean actionBarAvailable = false;
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // ActionBar anfragen
        actionBarAvailable = getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    }
    _logger = new Logger(this, "PlanActivity");
    setContentView(R.layout.activity_plan);
    this.ctxt = new MyContext(this, this);

    Configuration c = getResources().getConfiguration();
    this.orientation = c.orientation;
    _logger.Info("Creating PlanActivity with orientation int: " + orientation);
    try {
        File f = new File(this.getCacheDir(), "date.bin");
        if (f.exists() && f.canRead()) {
            ctxt.mProfil.stupid.currentDate = (Calendar) FileOPs.loadObject(f);
            f.delete();
        }
    } catch (Exception e) {
        _logger.Error("An Error occurred while loading date.bin file", e);
    }

    ctxt.mProfil = new ProfilManager(ctxt).getCurrentProfil();
    ctxt.mProfil.setPrefs();
    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
    lbm.registerReceiver(mMessageReceiver, new IntentFilter(Const.BROADCASTREFRESH));
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        int noticationId = extras.getInt("notificationId");

        if (noticationId != 0) {
            extras.remove("notificationId");
            //notication aus taskbar entfernen
            NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            nm.cancel(noticationId);
            Calendar date = new GregorianCalendar();
            date.setTimeInMillis(extras.getLong("date"));

            extras.remove("weekIndex");
            int profilIndex = extras.getInt("profilIndex");
            extras.remove("profilIndex");

            //alle Profile laden
            ProfilManager pm = new ProfilManager(ctxt);
            if (pm.profiles.size() >= pm.currentProfilIndex) {
                pm.profiles.get(pm.currentProfilIndex).setPrefs();
                if (profilIndex > pm.profiles.size() - 1)
                    profilIndex = 0;
                else
                    pm.currentProfilIndex = profilIndex;
                pm.applyProfilIndex();
                ctxt.mProfil.loadPrefs();
            }

            ctxt.mProfil.stupid.currentDate = date;

        }

        ctxt.newVersionReqSetup = extras.getBoolean("newVersionInfo", false);
    }

    ActionBar actionBar = getActionBar();
    if (ctxt.mIsRunning)
        actionBar.show();

    ctxt.executor.post(new PlanActivityLuncher(PlanActivity.this));

    //        FAB = (ImageButton) findViewById(R.id.imageButton);
    //        FAB.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                ctxt.getCurStupid().currentDate = new GregorianCalendar();
    //                ctxt.pager.setPage(ctxt.getCurStupid().currentDate);
    //            }
    //        });
}

From source file:org.wahtod.wififixer.ui.MainActivity.java

private void handleIntentMessage(Message message) {
    if (message.getData().isEmpty())
        return;//  w  w  w .  j  ava2  s. com
    Bundle data = message.getData();
    /*
     * Check (assuming SERVICEWARNED) for whether one-time alert fired
    */
    if (data.containsKey(PrefConstants.SERVICEWARNED)) {
        data.remove(PrefConstants.SERVICEWARNED);
        showServiceAlert();
    }
    /*
     * Delete Log if called by preference
    */
    else if (data.containsKey(WRITE_LOG)) {
        data.remove(WRITE_LOG);
        LogUtil.writeLogtoSd(this);
    } else if (data.containsKey(DELETE_LOG)) {
        data.remove(DELETE_LOG);
        File logFile = VersionedFile.getFile(this, LogUtil.LOGFILE);
        if (logFile.exists()) {
            LogUtil.deleteLog(this, VersionedFile.getFile(this, LogUtil.LOGFILE));
            NotifUtil.showToast(this, R.string.logfile_delete_toast);
        }
    } else if (data.containsKey(RUN_TUTORIAL)) {
        data.remove(RUN_TUTORIAL);
        phoneTutNag();
    } else if (data.containsKey(SHOW_HELP)) {
        this.startActivity(new Intent(this, HelpActivity.class));
    } else if (data.containsKey(SEND_LOG))
        LogUtil.sendLog(this);
    /*
     * Set Activity intent to one without commands we've "consumed"
    */
    Intent i = new Intent(data.getString(PrefUtil.INTENT_ACTION));
    i.putExtras(data);
    setIntent(i);
}

From source file:net.evendanan.pushingpixels.FragmentChauffeurActivity.java

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mIsActivityShown = true;//from   ww  w .  j  a  va2s  . co  m
    if (savedInstanceState == null) {
        //setting up the root of the UI.
        setRootFragment(createRootFragmentInstance());
        //now, checking if there is a request to add a fragment on-top of this one.
        Bundle activityArgs = getIntent().getExtras();
        if (activityArgs != null && activityArgs.containsKey(KEY_FRAGMENT_CLASS_TO_ADD)) {
            Class<? extends Fragment> fragmentClass = (Class<? extends Fragment>) activityArgs
                    .get(KEY_FRAGMENT_CLASS_TO_ADD);
            //not sure that this is a best-practice, but I still need to remove this from the activity's args
            activityArgs.remove(KEY_FRAGMENT_CLASS_TO_ADD);
            try {
                Fragment fragment = fragmentClass.newInstance();
                if (activityArgs.containsKey(KEY_FRAGMENT_ARGS_TO_ADD)) {
                    fragment.setArguments(activityArgs.getBundle(KEY_FRAGMENT_ARGS_TO_ADD));
                    activityArgs.remove(KEY_FRAGMENT_CLASS_TO_ADD);
                }
                addFragmentToUi(fragment, FragmentUiContext.RootFragment);
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:org.wheelmap.android.fragment.POIsMapWorkerFragment.java

@Override
public void requestSearch(Bundle bundle) {
    if (!bundle.containsKey(SearchManager.QUERY) && !bundle.containsKey(Extra.CATEGORY)
            && !bundle.containsKey(Extra.NODETYPE) && !bundle.containsKey(Extra.WHEELCHAIR_STATE)
            && !bundle.containsKey(Extra.WHEELCHAIR_TOILET_STATE)) {
        return;//www . j ava 2  s.  c  o  m
    }

    if (bundle.getInt(Extra.CATEGORY) == Extra.UNKNOWN) {
        bundle.remove(Extra.CATEGORY);
    }

    if (!bundle.containsKey(Extra.WHAT)) {
        int what;
        if (bundle.containsKey(Extra.CATEGORY) || bundle.containsKey(Extra.NODETYPE)) {
            what = What.RETRIEVE_NODES;
        } else {
            what = What.SEARCH_NODES_IN_BOX;
        }

        bundle.putInt(Extra.WHAT, what);
    }

    bundle.putParcelable(Extra.STATUS_RECEIVER, mReceiver);
    RestServiceHelper.executeRequest(getActivity(), bundle);
    setSearchModeInt(true);
}

From source file:org.arakhne.afc.ui.android.filechooser.FileChooserActivity.java

/** {@inheritDoc}
 *//*from  ww w . j  a va 2  s.  co  m*/
@Override
protected void onSaveInstanceState(Bundle outState) {
    if (this.path != null) {
        outState.putString(SAVED_PATH_NAME, this.path.getAbsolutePath());
    } else {
        outState.remove(SAVED_PATH_NAME);
    }
    if (this.fileFilter != null) {
        outState.putString(SAVED_FILE_FILTER, this.fileFilter.getClass().getName());
    } else {
        outState.remove(SAVED_FILE_FILTER);
    }
    if (this.iconSelector != null) {
        outState.putString(SAVED_ICON_SELECTOR, this.iconSelector.getClass().getName());
    } else {
        outState.remove(SAVED_ICON_SELECTOR);
    }
    outState.putBoolean(SAVED_IS_OPEN, this.isOpen);
    super.onSaveInstanceState(outState);
}

From source file:androidx.media.MediaBrowser2.java

/**
 * Subscribe to a parent id for the change in its children. When there's a change,
 * {@link BrowserCallback#onChildrenChanged(MediaBrowser2, String, int, Bundle)} will be called
 * with the bundle that you've specified. You should call
 * {@link #getChildren(String, int, int, Bundle)} to get the actual contents for the parent.
 *
 * @param parentId parent id/*from  ww  w  .j  a  va 2 s  .c o  m*/
 * @param extras extra bundle
 */
public void subscribe(@NonNull String parentId, @Nullable Bundle extras) {
    if (parentId == null) {
        throw new IllegalArgumentException("parentId shouldn't be null");
    }
    // TODO: Document this behavior
    Bundle option;
    if (extras != null && (extras.containsKey(MediaBrowserCompat.EXTRA_PAGE)
            || extras.containsKey(MediaBrowserCompat.EXTRA_PAGE_SIZE))) {
        option = new Bundle(extras);
        option.remove(MediaBrowserCompat.EXTRA_PAGE);
        option.remove(MediaBrowserCompat.EXTRA_PAGE_SIZE);
    } else {
        option = extras;
    }
    SubscribeCallback callback = new SubscribeCallback();
    synchronized (mLock) {
        List<SubscribeCallback> list = mSubscribeCallbacks.get(parentId);
        if (list == null) {
            list = new ArrayList<>();
            mSubscribeCallbacks.put(parentId, list);
        }
        list.add(callback);
    }
    // TODO: Revisit using default browser is OK. Here's my concern.
    //       Assume that MediaBrowser2 is connected with the MediaBrowserServiceCompat.
    //       Since MediaBrowserServiceCompat can call MediaBrowserServiceCompat#
    //       getBrowserRootHints(), the service may refuse calls from MediaBrowser2
    getBrowserCompat().subscribe(parentId, option, callback);
}

From source file:com.facebook.share.ShareApi.java

private static void handleImagesOnAction(Bundle parameters) {
    // In general, graph objects are passed by reference (ID/URL). But if this is an OG Action,
    // we need to pass the entire values of the contents of the 'image' property, as they
    // contain important metadata beyond just a URL.
    String imageStr = parameters.getString("image");
    if (imageStr != null) {
        try {/*from   www  . jav a2  s .  c o m*/
            // Check to see if this is an json array. Will throw if not
            JSONArray images = new JSONArray(imageStr);
            for (int i = 0; i < images.length(); ++i) {
                JSONObject jsonImage = images.optJSONObject(i);
                if (jsonImage != null) {
                    putImageInBundleWithArrayFormat(parameters, i, jsonImage);
                } else {
                    // If we don't have jsonImage we probably just have a url
                    String url = images.getString(i);
                    parameters.putString(String.format(Locale.ROOT, "image[%d][url]", i), url);
                }
            }
            parameters.remove("image");
            return;
        } catch (JSONException ex) {
            // We couldn't parse the string as an array
        }

        // If the image is not in an array it might just be an single photo
        try {
            JSONObject image = new JSONObject(imageStr);
            putImageInBundleWithArrayFormat(parameters, 0, image);
            parameters.remove("image");
        } catch (JSONException exception) {
            // The image was not in array format or a json object and can be safely passed
            // without modification
        }
    }
}