List of usage examples for android.content Intent getBundleExtra
public Bundle getBundleExtra(String name)
From source file:com.android.tv.settings.users.AppRestrictionsFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); AppRestrictionsPreference pref = (AppRestrictionsPreference) findPreference( mCustomRequestMap.get(requestCode)); if (pref == null) { Log.w(TAG, "Unknown requestCode " + requestCode); return;//from w w w . j a v a 2 s. c o m } if (resultCode == Activity.RESULT_OK) { String packageName = getPackageFromKey(pref.getKey()); ArrayList<RestrictionEntry> list = data.getParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST); Bundle bundle = data.getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE); if (list != null) { // If there's a valid result, persist it to the user manager. pref.setRestrictions(list); mUserManager.setApplicationRestrictions(packageName, RestrictionsManager.convertRestrictionsToBundle(list), mUser); } else if (bundle != null) { // If there's a valid result, persist it to the user manager. mUserManager.setApplicationRestrictions(packageName, bundle, mUser); } } // Remove request from the map mCustomRequestMap.remove(requestCode); }
From source file:org.andstatus.app.TimelineActivity.java
private void parseAppSearchData(Intent intentNew) { Bundle appSearchData = intentNew.getBundleExtra(SearchManager.APP_DATA); if (appSearchData != null) { // We use other packaging of the same parameters in onSearchRequested mListParametersNew.setTimelineType( TimelineTypeEnum.load(appSearchData.getString(IntentExtra.EXTRA_TIMELINE_TYPE.key))); if (mListParametersNew.getTimelineType() != TimelineTypeEnum.UNKNOWN) { mListParametersNew.setTimelineCombined(appSearchData.getBoolean( IntentExtra.EXTRA_TIMELINE_IS_COMBINED.key, mListParametersNew.isTimelineCombined())); /* The query itself is still from the Intent */ mListParametersNew.mSearchQuery = TimelineListParameters .notNullString(intentNew.getStringExtra(SearchManager.QUERY)); mListParametersNew.mSelectedUserId = appSearchData.getLong(IntentExtra.EXTRA_SELECTEDUSERID.key, mListParametersNew.mSelectedUserId); if (!TextUtils.isEmpty(mListParametersNew.mSearchQuery) && appSearchData.getBoolean(IntentExtra.EXTRA_GLOBAL_SEARCH.key, false)) { setSyncing("Global search: " + mListParametersNew.mSearchQuery, true); MyServiceManager/*from w ww .ja v a 2 s . co m*/ .sendForegroundCommand( CommandData.searchCommand( isTimelineCombined() ? "" : MyContextHolder.get().persistentAccounts() .getCurrentAccountName(), mListParametersNew.mSearchQuery)); } } } }
From source file:org.getlantern.firetweet.activity.support.HomeActivity.java
private int handleIntent(final Intent intent, final boolean firstCreate) { // use packge's class loader to prevent BadParcelException intent.setExtrasClassLoader(getClassLoader()); // reset intent setIntent(new Intent(this, HomeActivity.class)); final String action = intent.getAction(); if (Intent.ACTION_SEARCH.equals(action)) { final String query = intent.getStringExtra(SearchManager.QUERY); final Bundle appSearchData = intent.getBundleExtra(SearchManager.APP_DATA); final long accountId; if (appSearchData != null && appSearchData.containsKey(EXTRA_ACCOUNT_ID)) { accountId = appSearchData.getLong(EXTRA_ACCOUNT_ID, -1); } else {/*from w w w . ja va 2 s. c o m*/ accountId = getDefaultAccountId(this); } openSearch(this, accountId, query); return -1; } final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false); final long[] refreshedIds = intent.getLongArrayExtra(EXTRA_REFRESH_IDS); if (refreshedIds != null) { mTwitterWrapper.refreshAll(refreshedIds); } else if (firstCreate && refreshOnStart) { mTwitterWrapper.refreshAll(); } final Uri uri = intent.getData(); final String tabType = uri != null ? Utils.matchTabType(uri) : null; int initialTab = -1; if (tabType != null) { final long accountId = ParseUtils.parseLong(uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID)); for (int i = mPagerAdapter.getCount() - 1; i > -1; i--) { final SupportTabSpec tab = mPagerAdapter.getTab(i); if (tabType.equals(tab.type)) { initialTab = i; if (hasAccountId(tab.args, accountId)) { break; } } } } if (initialTab != -1 && mViewPager != null) { // clearNotification(initial_tab); } final Intent extraIntent = intent.getParcelableExtra(EXTRA_EXTRA_INTENT); if (extraIntent != null && firstCreate) { extraIntent.setExtrasClassLoader(getClassLoader()); startActivity(extraIntent); } return initialTab; }
From source file:de.vanita5.twittnuker.activity.support.HomeActivity.java
private int handleIntent(final Intent intent, final boolean firstCreate) { // use packge's class loader to prevent BadParcelException intent.setExtrasClassLoader(getClassLoader()); // reset intent setIntent(new Intent(this, HomeActivity.class)); final String action = intent.getAction(); if (Intent.ACTION_SEARCH.equals(action)) { final String query = intent.getStringExtra(SearchManager.QUERY); final Bundle appSearchData = intent.getBundleExtra(SearchManager.APP_DATA); final long accountId; if (appSearchData != null && appSearchData.containsKey(EXTRA_ACCOUNT_ID)) { accountId = appSearchData.getLong(EXTRA_ACCOUNT_ID, -1); } else {/*from ww w . java2s . com*/ accountId = getDefaultAccountId(this); } openSearch(this, accountId, query); return -1; } final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false); final long[] refreshedIds = intent.getLongArrayExtra(EXTRA_IDS); if (refreshedIds != null) { mTwitterWrapper.refreshAll(refreshedIds); } else if (firstCreate && refreshOnStart) { mTwitterWrapper.refreshAll(); } final int tab = intent.getIntExtra(EXTRA_INITIAL_TAB, -1); final int initialTab = tab != -1 ? tab : getAddedTabPosition(this, intent.getStringExtra(EXTRA_TAB_TYPE)); if (initialTab != -1 && mViewPager != null) { // clearNotification(initial_tab); } final Intent extraIntent = intent.getParcelableExtra(EXTRA_EXTRA_INTENT); if (extraIntent != null && firstCreate) { extraIntent.setExtrasClassLoader(getClassLoader()); SwipebackActivityUtils.startSwipebackActivity(this, extraIntent); } return initialTab; }
From source file:com.hackensack.umc.activity.RegistrationDetailsActivity.java
private void getIntentData(Intent intent) { Bundle bundle = intent.getBundleExtra(Constant.BUNDLE); regMode = bundle.getInt(Constant.REGISTRATION_MODE, 0); if (regMode == Constant.AUTO) { DataForAutoRegistration dataForAutoRegistration = (DataForAutoRegistration) bundle .getSerializable(Constant.REG_REQUIRED_DATA); Log.v(TAG, dataForAutoRegistration.toString()); pathSelfie = bundle.getString(Constant.KEY_SLFIE); pathIdFront = bundle.getString(Constant.KEY_ID_FRONT); try {//from www. ja v a2 s . co m pathIdBack = bundle.getString(Constant.KEY_ID_BACK); pathIcFront = bundle.getString(Constant.KEY_INSURANCE_FRONT); pathIcBack = bundle.getString(Constant.KEY_INSURANCE_BACK); } catch (Exception e) { } setDataToField(dataForAutoRegistration); } //proceedAccordingToActivityMode(regMode); }
From source file:org.cobaltians.cobalt.fragments.CobaltFragment.java
/***************************************************************************************************************** * NAVIGATION/*from w ww . j a v a2 s. c o m*/ ****************************************************************************************************************/ private void push(JSONObject data) { try { String page = data.getString(Cobalt.kJSPage); String controller = data.optString(Cobalt.kJSController, null); JSONObject bars = data.optJSONObject(Cobalt.kJSBars); JSONObject dataToPush = data.optJSONObject(Cobalt.kJSData); Intent intent = Cobalt.getInstance(mContext).getIntentForController(controller, page); if (intent != null) { if (bars != null) { Bundle configuration = intent.getBundleExtra(Cobalt.kExtras); configuration.putString(Cobalt.kBars, bars.toString()); } if (dataToPush != null) { intent.putExtra(Cobalt.kJSData, dataToPush.toString()); } mContext.startActivity(intent); } else if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - push: unable to push " + controller + " controller."); } } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - push: missing mandatory page field."); } exception.printStackTrace(); } }
From source file:org.cobaltians.cobalt.fragments.CobaltFragment.java
private void replace(JSONObject data) { try {/*from ww w .j av a 2 s. co m*/ String page = data.getString(Cobalt.kJSPage); String controller = data.optString(Cobalt.kJSController, null); JSONObject bars = data.optJSONObject(Cobalt.kJSBars); JSONObject dataForReplace = data.optJSONObject(Cobalt.kJSData); boolean animated = data.optBoolean(Cobalt.kJSAnimated); boolean clearHistory = data.optBoolean(Cobalt.kJSClearHistory, false); Intent intent = Cobalt.getInstance(mContext).getIntentForController(controller, page); if (intent != null) { intent.putExtra(Cobalt.kJSAnimated, animated); if (bars != null) { Bundle configuration = intent.getBundleExtra(Cobalt.kExtras); configuration.putString(Cobalt.kBars, bars.toString()); } if (dataForReplace != null) { intent.putExtra(Cobalt.kJSData, dataForReplace.toString()); } if (clearHistory) { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); } mContext.startActivity(intent); ((Activity) mContext).finish(); } else if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - replace: unable to replace " + controller + " controller."); } } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - replace: missing mandatory page field."); } exception.printStackTrace(); } }
From source file:org.cobaltians.cobalt.fragments.CobaltFragment.java
private void presentModal(JSONObject data, String callBackID) { try {//from ww w . j av a 2 s . c om String page = data.getString(Cobalt.kJSPage); String controller = data.optString(Cobalt.kJSController, null); JSONObject bars = data.optJSONObject(Cobalt.kJSBars); JSONObject dataForModal = data.optJSONObject(Cobalt.kJSData); Intent intent = Cobalt.getInstance(mContext).getIntentForController(controller, page); if (intent != null) { intent.putExtra(Cobalt.kPushAsModal, true); if (bars != null) { Bundle configuration = intent.getBundleExtra(Cobalt.kExtras); configuration.putString(Cobalt.kBars, bars.toString()); } if (dataForModal != null) { intent.putExtra(Cobalt.kJSData, dataForModal.toString()); } mContext.startActivity(intent); // Sends callback to store current activity & HTML page for dismiss try { JSONObject callbackData = new JSONObject(); callbackData.put(Cobalt.kJSPage, getPage()); callbackData.put(Cobalt.kJSController, mContext.getClass().getName()); sendCallback(callBackID, callbackData); } catch (JSONException exception) { exception.printStackTrace(); } } else if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - presentModal: unable to present modal " + controller + " controller."); } } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - presentModal: missing mandatory page field."); } exception.printStackTrace(); } }
From source file:com.brandroidtools.filemanager.activities.NavigationActivity.java
/** * Method that verifies the intent passed to the activity, and checks * if a request is made like Search.//from w ww. j av a2s.c om * * @param intent The intent to check * @hide */ void checkIntent(Intent intent) { //Search action if (Intent.ACTION_SEARCH.equals(intent.getAction())) { Intent searchIntent = new Intent(this, SearchActivity.class); searchIntent.setAction(Intent.ACTION_SEARCH); //- SearchActivity.EXTRA_SEARCH_DIRECTORY searchIntent.putExtra(SearchActivity.EXTRA_SEARCH_DIRECTORY, getCurrentNavigationFragment().getCurrentDir()); //- SearchManager.APP_DATA if (intent.getBundleExtra(SearchManager.APP_DATA) != null) { Bundle bundle = new Bundle(); bundle.putAll(intent.getBundleExtra(SearchManager.APP_DATA)); searchIntent.putExtra(SearchManager.APP_DATA, bundle); } //-- SearchManager.QUERY String query = intent.getStringExtra(SearchManager.QUERY); if (query != null) { searchIntent.putExtra(SearchManager.QUERY, query); } //- android.speech.RecognizerIntent.EXTRA_RESULTS ArrayList<String> extraResults = intent .getStringArrayListExtra(android.speech.RecognizerIntent.EXTRA_RESULTS); if (extraResults != null) { searchIntent.putStringArrayListExtra(android.speech.RecognizerIntent.EXTRA_RESULTS, extraResults); } startActivityForResult(searchIntent, INTENT_REQUEST_SEARCH); return; } // Navigate to the requested path String navigateTo = intent.getStringExtra(EXTRA_NAVIGATE_TO); if (navigateTo != null && navigateTo.length() >= 0) { getCurrentNavigationFragment().changeCurrentDir(navigateTo); } }
From source file:org.xbmc.kore.service.LibrarySyncService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { // Get the connection here, not on create because we can be called for different hosts // We'll use a specific connection through HTTP, not the singleton one, // to not interfere with the normal application usage of it (namely calls to disconnect // and usage of the socket). HostInfo hostInfo = HostManager.getInstance(this).getHostInfo(); SyncOrchestrator syncOrchestrator = new SyncOrchestrator(this, startId, hostInfo, callbackHandler, getContentResolver());//from w w w. ja v a2 s. co m syncOrchestrators.add(syncOrchestrator); // Get the request parameters that we should pass when calling back the caller Bundle syncExtras = intent.getBundleExtra(SYNC_EXTRAS); // Sync all movies boolean syncAllMovies = intent.getBooleanExtra(SYNC_ALL_MOVIES, false); if (syncAllMovies) { syncOrchestrator.addSyncItem(new SyncMovies(hostInfo.getId(), syncExtras)); } // Sync a single movie boolean syncSingleMovie = intent.getBooleanExtra(SYNC_SINGLE_MOVIE, false); if (syncSingleMovie) { int movieId = intent.getIntExtra(SYNC_MOVIEID, -1); if (movieId != -1) { syncOrchestrator.addSyncItem(new SyncMovies(hostInfo.getId(), movieId, syncExtras)); } } // Sync all tvshows boolean syncAllTVShows = intent.getBooleanExtra(SYNC_ALL_TVSHOWS, false); if (syncAllTVShows) { syncOrchestrator.addSyncItem(new SyncTVShows(hostInfo.getId(), syncExtras)); } // Sync a single tvshow boolean syncSingleTVShow = intent.getBooleanExtra(SYNC_SINGLE_TVSHOW, false); if (syncSingleTVShow) { int tvshowId = intent.getIntExtra(SYNC_TVSHOWID, -1); if (tvshowId != -1) { syncOrchestrator.addSyncItem(new SyncTVShows(hostInfo.getId(), tvshowId, syncExtras)); } } // Sync all music boolean syncAllMusic = intent.getBooleanExtra(SYNC_ALL_MUSIC, false); if (syncAllMusic) { syncOrchestrator.addSyncItem(new SyncMusic(hostInfo.getId(), syncExtras)); } // Sync all music videos boolean syncAllMusicVideos = intent.getBooleanExtra(SYNC_ALL_MUSIC_VIDEOS, false); if (syncAllMusicVideos) { syncOrchestrator.addSyncItem(new SyncMusicVideos(hostInfo.getId(), syncExtras)); } // Start syncing syncOrchestrator.startSync(); // If we get killed, after returning from here, don't restart return START_NOT_STICKY; }