List of usage examples for android.os Bundle get
@Nullable
public Object get(String key)
From source file:edu.oakland.cse480.GCMIntentService.java
@Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // The getMessageType() intent parameter must be the intent you received // in your BroadcastReceiver. String messageType = gcm.getMessageType(intent); sendCustNotification((String) extras.get("message")); // Release the wake lock provided by the WakefulBroadcastReceiver. GcmBroadcastReceiver.completeWakefulIntent(intent); }
From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardAuthenticator.java
public void executeAuthentication() { // Gets the auth token asynchronously, calling the callback with its result (uses the // deprecated API which is the only one supported from API level 5). AccountManager.get(mApplicationContext).getAuthToken(mAccount, AUTH_TOKEN_TYPE, false, new AccountManagerCallback<Bundle>() { public void run(AccountManagerFuture result) { Bundle bundle; try { LogUtils.i("AppEngineDashboardAuthenticator", "GetAuthTokenCallback.onPostExecute started..."); bundle = (Bundle) result.getResult(); Intent intent = (Intent) bundle.get(AccountManager.KEY_INTENT); if (intent != null) { // User input required LogUtils.i("AppEngineDashboardAuthenticator", "User input is required..."); mOnUserInputRequiredCallback.onUserInputRequired(intent); } else { LogUtils.i("AppEngineDashboardAuthenticator", "Authenticated, getting auth token..."); onGetAuthToken(bundle); }/*w w w .j a v a 2 s . c o m*/ } catch (Exception e) { // Can happen because of various like connectivity issues, google server errors, etc. LogUtils.e("AppEngineDashboardAuthenticator", "Exception caught from GetAuthTokenCallback", e); mPostAuthenticateCallback.run(false); } } }, null); }
From source file:com.khoahuy.phototag.HomeActivity.java
private void handleSmallCameraPhoto(Intent intent) { if (mCurrentPhotoPath != null) { Bundle extras = intent.getExtras(); Bitmap bm = (Bitmap) extras.get("data"); File file = new File(mCurrentPhotoPath); if (file.exists()) file.delete();//w w w. j av a2 s . com try { FileOutputStream out = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } NFCItem item = new NFCItem(); item.setNfcid(nfcid); item.setImage(mCurrentPhotoPath); item.setCheckIn(DateUtils.getCurrentTimestamp()); nfcProvider.addWaitingItem(item); mCurrentPhotoPath = null; } }
From source file:jen.jobs.application.UpdateJobSeeking.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (requestCode == SELECT_JOB_SEEKING_STATUS) { // Make sure the request was successful if (resultCode == RESULT_OK) { Bundle filters = data.getExtras(); JobSeekingStatus selectedValues = (JobSeekingStatus) filters.get("jobseekingstatus"); if (selectedValues != null) { selectedJobSeekingStatusValues = selectedValues; selectedJobSeekingStatus.setText(selectedValues.name); }//from w w w. j av a 2 s. co m } } else if (requestCode == SELECT_COUNTRY) { if (resultCode == RESULT_OK) { Bundle filters = data.getExtras(); Country selectedValues = (Country) filters.get("country"); if (selectedValues != null) { selectedCountryValues = selectedValues; selectedCountry.setText(selectedValues.name); if (selectedValues.id == 127) { selectMalaysiaState.setVisibility(View.VISIBLE); selectMalaysiaStateSibling.setVisibility(View.VISIBLE); } else { selectMalaysiaState.setVisibility(View.GONE); selectMalaysiaStateSibling.setVisibility(View.GONE); } } } } else if (requestCode == SELECT_STATE) { if (resultCode == RESULT_OK) { Bundle filters = data.getExtras(); State c = (State) filters.get("state"); selectedMalaysiaStateValues = c; if (c != null) { selectedMalaysiaState.setText(c.name); } } } else if (requestCode == SELECT_JOB_NOTICE) { if (resultCode == RESULT_OK) { Bundle filters = data.getExtras(); selectedAvailability = filters.getString("availability"); selectedAvailabilityUnit = filters.getString("availabilityUnit"); String a = selectedAvailability + " " + selectedAvailabilityUnit; selectedJobNotice.setText(a); } } }
From source file:com.example.leandromaguna.myapp.Presentation.PlacesMap.PlacesMapActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_PLACE) { if (resultCode == RESULT_OK) { Log.i(TAG, "REQUEST_PLACE/RESULT_OK"); //Agrego marker a la lista Bundle newPlace = data.getBundleExtra("savedPlace"); MarkerOptions newMarker = new MarkerOptions().position((LatLng) newPlace.get("position")) .title((String) newPlace.get("title")).snippet((String) newPlace.get("description")); markers.add(newMarker);/*from www . jav a 2 s . c o m*/ setMarkersOnMap(); } else { Log.i(TAG, "REQUEST_PLACE/ELSE"); } } }
From source file:fragments.ToolViewPagerFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.cours_fragment, container, false); final AppActivity a = (AppActivity) getActivity(); Bundle extras = getArguments(); int tabIndex = -1; if (extras != null) { mCurrentCours = new Select().from(Cours.class).where("Id = ?", extras.get("coursID")).executeSingle(); tabIndex = extras.getInt("tab", -1); }//from w ww .j a v a2 s .c o m if (mCurrentCours == null && !App.isTwoPane()) { a.finish(); } mViewPager = (ViewPager) v.findViewById(R.id.pager); mAdapter = new ResourcesListPagerAdapter(getChildFragmentManager(), mCurrentCours, getArguments()); mViewPager.setAdapter(mAdapter); if (mCurrentCours.isExpired() || mCurrentCours.lists().size() == 0 && a.mustUpdate(AppActivity.ONCE_PER_DAY)) { a.setProgressIndicator(true); a.getService().updateCompleteCourse(mCurrentCours, a, new AsyncHttpResponseHandler() { @Override public void onFinish() { a.setProgressIndicator(false); } @Override public void onSuccess(final String response) { refreshUI(); a.updatesNow(); } }); } else if (mCurrentCours.isTimeToUpdate()) { a.setProgressIndicator(true); a.getService().getUpdates(new AsyncHttpResponseHandler() { @Override public void onFinish() { a.setProgressIndicator(false); } @Override public void onSuccess(final String response) { if (!response.equals("[]")) { refreshUI(); } a.updatesNow(); } }); } if (savedInstanceState != null) { mViewPager.setCurrentItem(savedInstanceState.getInt("tab", 0), true); } else if (tabIndex > -1) { mViewPager.setCurrentItem(tabIndex, true); } return v; }
From source file:org.inftel.ssa.mobile.ui.fragments.ProjectDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.ssa_project_details, container, false); Bundle arguments = getArguments(); if (arguments != null && arguments.get("_uri") != null) { mContentUri = (Uri) arguments.get("_uri"); }//from w w w .j ava 2 s .c o m setHasOptionsMenu(true); // Handle sprints click view.findViewById(R.id.project_btn_sprints).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ACTION_VIEW, Projects.buildSprintsDirUri(mProjectId))); } }); // Handle users click view.findViewById(R.id.project_btn_users).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ACTION_VIEW, Projects.buildUsersDirUri(mProjectId))); } }); // Handle tasks click view.findViewById(R.id.project_btn_tasks).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ACTION_VIEW, Projects.buildTasksDirUri(mProjectId))); } }); TabHost tabHost = (TabHost) view.findViewById(android.R.id.tabhost); tabHost.setup(); setupDescriptionTab(view); setupLinksTab(view); setupInformationTab(view); return view; }
From source file:com.notifry.android.remote.BackendClient.java
private String getAuthToken(Context context, Account account) throws PendingAuthException { String authToken = null;/*from ww w . jav a2 s.c o m*/ AccountManager accountManager = AccountManager.get(context); try { AccountManagerFuture<Bundle> future = accountManager.getAuthToken(account, "ah", false, null, null); Bundle bundle = future.getResult(); authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN); // User will be asked for "App Engine" permission. if (authToken == null) { // No auth token - will need to ask permission from user. Intent intent = (Intent) bundle.get(AccountManager.KEY_INTENT); if (intent != null) { // User input required context.startActivity(intent); throw new PendingAuthException("Asking user for permission."); } } } catch (OperationCanceledException e) { Log.w(TAG, e.getMessage()); } catch (AuthenticatorException e) { Log.w(TAG, e.getMessage()); } catch (IOException e) { Log.w(TAG, e.getMessage()); } return authToken; }
From source file:de.eidottermihi.rpicheck.activity.CustomCommandActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Show the Up button in the action bar. getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(true); Bundle extras = this.getIntent().getExtras(); if (extras != null && extras.get("pi") != null) { LOGGER.debug("onCreate: get currentDevice out of intent."); currentDevice = (RaspberryDeviceBean) extras.get("pi"); } else if (savedInstanceState.getSerializable("pi") != null) { LOGGER.debug("onCreate: get currentDevice out of savedInstanceState."); currentDevice = (RaspberryDeviceBean) savedInstanceState.getSerializable("pi"); }//from w w w .java 2s . com if (currentDevice != null) { LOGGER.debug("Setting activity title for device."); getSupportActionBar().setTitle(currentDevice.getName()); LOGGER.debug("Initializing ListView"); this.initListView(currentDevice); } else { LOGGER.debug("No current device! Setting no title"); } }
From source file:com.precisosol.llgeofence.GeofencePlugin.java
public void TriggeredGeofence(Bundle extras) { BorderEvent borderEvent = (BorderEvent) extras.get(BorderEvent.EXTRA_BORDER_EVENT); Geofence geofence = (Geofence) extras.get(Geofence.EXTRA_GEOFENCE); if (borderEvent == null || geofence == null) { Log.w(LOG, "Geofence fired, but report is incomplete. Will not notify user: " + extras); } else {/* w w w .ja v a 2 s . com*/ if (borderEvent.getCrossingType() == Geofence.CROSSING_TYPE_ENTER) { TriggeredEntryGeofence(geofence); } else if (borderEvent.getCrossingType() == Geofence.CROSSING_TYPE_EXIT) { TriggeredExitGeofence(geofence); } } }